Skip to content

Commit 654a04a

Browse files
committed
Reject CRAM blocks with an unknown compression method.
1 parent e64e68d commit 654a04a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

cram/cram_io.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,10 @@ cram_block *cram_read_block(cram_fd *fd) {
14211421
//fprintf(stderr, "Block at %d\n", (int)ftell(fd->fp));
14221422

14231423
if (-1 == (b->method = hgetc(fd->fp))) { free(b); return NULL; }
1424+
if (b->method > TOK3) {
1425+
hts_log_error("Unknown block compression method %d", (int) b->method);
1426+
free(b); return NULL;
1427+
}
14241428
c = b->method; crc = crc32(crc, &c, 1);
14251429
if (-1 == (b->content_type= hgetc(fd->fp))) { free(b); return NULL; }
14261430
c = b->content_type; crc = crc32(crc, &c, 1);

0 commit comments

Comments
 (0)