Skip to content

Commit

Permalink
Fix hts_idx_get_n_no_coor() out-of-bounds memory access
Browse files Browse the repository at this point in the history
For CRAI-indexed CRAM files idx actually points to an hts_cram_idx_t,
which has no n_no_coor field. Return an appropriate "not available"
value instead.
  • Loading branch information
jmarshall committed Sep 28, 2021
1 parent f05aff6 commit 2dbbcf6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hts.c
Original file line number Diff line number Diff line change
Expand Up @@ -2789,6 +2789,7 @@ int hts_idx_get_stat(const hts_idx_t* idx, int tid, uint64_t* mapped, uint64_t*

uint64_t hts_idx_get_n_no_coor(const hts_idx_t* idx)
{
if (idx->fmt == HTS_FMT_CRAI) return 0;
return idx->n_no_coor;
}

Expand Down

0 comments on commit 2dbbcf6

Please sign in to comment.