Skip to content

Commit

Permalink
fix potential buffer overwrite with zip data (#1974)
Browse files Browse the repository at this point in the history
If the zipped data unpacks to a buffer which is too large, but still
within the scratch buffer size, could potentially write past the end of
the buffer

Signed-off-by: Kimball Thurston <[email protected]>
  • Loading branch information
kdt3rd authored Feb 8, 2025
1 parent 7044bc9 commit 928f9a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/OpenEXRCore/internal_zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ undo_zip_impl (
if (res == EXR_ERR_SUCCESS)
{
decode->bytes_decompressed = actual_out_bytes;
if (comp_buf_size > actual_out_bytes)
if (comp_buf_size > actual_out_bytes || actual_out_bytes > uncompressed_size)
res = EXR_ERR_CORRUPT_CHUNK;
else
internal_zip_reconstruct_bytes (
Expand Down

0 comments on commit 928f9a4

Please sign in to comment.