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 <peterh@wetafx.co.nz>
  • Loading branch information
peterhillman authored Jun 3, 2021
1 parent b38cd51 commit 25259a8
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 25259a8

Please sign in to comment.