rtissera / libchdr

Standalone library for reading MAME's CHDv1-v5 formats.
BSD 3-Clause "New" or "Revised" License
96 stars 38 forks source link

Crash in huffman_import_tree_rle #90

Closed flyinghead closed 1 year ago

flyinghead commented 1 year ago

I'm getting a few crash reports such as: EXCEPTION_ACCESS_VIOLATION_WRITE image Currently using 2781322c4a7f8315c5fd6499129ad4b718e35843

I assume these are due to corrupted CHDs but I haven't been able to reproduce the crash, even when hacking the code. it looks like an overflow of the decoder->huffnode array.

May be add this on line 215?:

    if (repcount + curnode > decoder->numcodes)
        return HUFFERR_INVALID_DATA;