Repository navigation
Fix security issues - #3489
Fix security issues#3489
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3489 +/- ##
==========================================
- Coverage 91.68% 91.68% -0.01%
==========================================
Files 38 38
Lines 32233 32241 +8
Branches 5153 5155 +2
==========================================
+ Hits 29554 29559 +5
Misses 2346 2346
- Partials 333 336 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Also tacked on a couple of extra fixes which came up while looking at this. |
|
I am diving a little into the C code at the moment, and the changes here all LGTM. In particular, in the C code I was able to figure out what the (minor) changes fixed before reading the summaries. But I guess someone else with better knowledge of the C code should formally approve. |
|
Ah, whoops! Thanks, I'll look into this |
Sample and ancestor IDs equal to the number of nodes were accepted, leading to out-of-bounds accesses on node-sized arrays. Closes tskit-dev#3484
Sample IDs equal to the number of nodes were accepted by both ibd_within and ibd_between, leading to an out-of-bounds write on the sample_set_id array. Closes tskit-dev#3485 Add link_ancestors test skipping an internal node Restores coverage of the non-merging append in ancestor_mapper_add_ancestry, previously only reached by a Python test that relied on an out-of-bounds ancestor ID.
delete_older used edge parents, mutation nodes and mutation parents as array indexes without validation, after it had already started rewriting the tables. Invalid references led to out-of-bounds reads and partially modified tables. Closes tskit-dev#3486
The table metadata schema tests computed the length of example2 using strlen(example), reading past the end of the shorter string. test_zero_edges passed a single tsk_id_t as the simplify node_map, which must have space for every input node.
The number of reference sets was used to compute an allocation size before being checked, so out-of-range values led to very large (or overflowing) allocation requests before the error was returned.
56dccf0 to
0570380
Compare
|
Great catch @petrelharp - turns out one of the old tests was using an out-of-bounds node to test this code path. Added a new test to do it properly. |

Fixes a handful of security issues reported by @gregorgorjanc - Codex was spot on.
I'm quite pleased that this is all that security audits are surfacing - go tskit!