Skip to content

Commit

Permalink
Fix a minor memory leak in malformed CRAM EXTERNAL blocks. (#1671)
Browse files Browse the repository at this point in the history
If we have an unofficial CRAM v4.0 encoded file and are attempting to
use non-byte based data in an EXTERNAL encoded block, then we didn't
free the cram_codecs structure when failing to parse and initialise.

Credit to OSS-Fuzz
Fixes oss-fuzz 62144
  • Loading branch information
jkbonfield authored Sep 13, 2023
1 parent 5acbc15 commit 9683431
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cram/cram_codecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,10 @@ cram_codec *cram_external_decode_init(cram_block_compression_hdr *hdr,
else if (option == E_BYTE || option == E_BYTE_ARRAY)
c->decode = cram_external_decode_char;
else
return NULL;
goto malformed;
break;
default:
return NULL;
goto malformed;
}
} else {
// CRAM 3 and earlier encodes integers as EXTERNAL. We need
Expand Down

0 comments on commit 9683431

Please sign in to comment.