Skip to content

Commit

Permalink
Fix missing guard check (#1329)
Browse files Browse the repository at this point in the history
Addresses OSS-FUZZ
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52730

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd committed Feb 2, 2023
1 parent 436fcd2 commit 063a881
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib/OpenEXRCore/internal_huf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,9 +1280,21 @@ fasthuf_initialize (
codeCount[codeLen]++;
}
else if (codeLen == (uint64_t) LONG_ZEROCODE_RUN)
{
if (currByte >= topByte)
{
if (pctxt)
pctxt->print_error (
pctxt,
EXR_ERR_CORRUPT_CHUNK,
"Error decoding Huffman table (Truncated table data).");
return EXR_ERR_CORRUPT_CHUNK;
}

symbol +=
fasthuf_read_bits (8, &currBits, &currBitCount, &currByte) +
SHORTEST_LONG_RUN - 1;
}
else
symbol += codeLen - SHORT_ZEROCODE_RUN + 1;

Expand Down

0 comments on commit 063a881

Please sign in to comment.