Skip to content

Commit

Permalink
detect buffer overflows in RleUncompress (#1036)
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hillman <[email protected]>
  • Loading branch information
peterhillman authored and cary-ilm committed Jun 30, 2021
1 parent 466d786 commit dbfaf8a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/OpenEXR/ImfRle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ rleUncompress (int inLength, int maxLength, const signed char in[], char out[])
if (0 > (maxLength -= count + 1))
return 0;

// check the input buffer is big enough to contain
// byte to be duplicated
if (inLength < 0)
return 0;

memset(out, *(char*)in, count+1);
out += count+1;

Expand Down

0 comments on commit dbfaf8a

Please sign in to comment.