Skip to content

Commit

Permalink
Merge pull request #91 from flyinghead/master
Browse files Browse the repository at this point in the history
Avoid huffman tree buffer overrun in huffman_import_tree_rle
rtissera authored Feb 19, 2023
2 parents a20e04c + de74053 commit 4ddae00
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libchdr_huffman.c
Original file line number Diff line number Diff line change
@@ -212,6 +212,8 @@ enum huffman_error huffman_import_tree_rle(struct huffman_decoder* decoder, stru
else
{
int repcount = bitstream_read(bitbuf, numbits) + 3;
if (repcount + curnode > decoder->numcodes)
return HUFFERR_INVALID_DATA;
while (repcount--)
decoder->huffnode[curnode++].numbits = nodebits;
}

0 comments on commit 4ddae00

Please sign in to comment.