Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible shift of negative value in cram_encode_aux() #1707

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cram/cram_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2844,7 +2844,9 @@ static sam_hrec_rg_t *cram_encode_aux(cram_fd *fd, bam_seq_t *b,

// Container level tags_used, for TD series
// Maps integer key ('X0i') to cram_tag_map struct.
int key = (aux[0]<<16)|(aux[1]<<8)|aux[2];
int key = (((unsigned char *) aux)[0]<<16 |
((unsigned char *) aux)[1]<<8 |
((unsigned char *) aux)[2]);
k = kh_put(m_tagmap, c->tags_used, key, &r);
if (-1 == r)
goto err;
Expand Down