Skip to content

Commit

Permalink
prevent overflow in hufUncompress if nBits is large (AcademySoftwareF…
Browse files Browse the repository at this point in the history
…oundation#836)

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
  • Loading branch information
peterhillman committed Dec 6, 2020
1 parent fc439bc commit d63b19d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfHuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,9 @@ hufUncompress (const char compressed[],

const char *ptr = compressed + 20;

if ( ptr + (nBits+7 )/8 > compressed+nCompressed)
uint64_t nBytes = (static_cast<uint64_t>(nBits)+7) / 8 ;

if ( ptr + nBytes > compressed+nCompressed)
{
notEnoughData();
return;
Expand Down

0 comments on commit d63b19d

Please sign in to comment.