Fix missing INT_MAX cap on deep scanline sample_count_table_size (#2535)

ddata[1] (packed_size) and ddata[2] (unpacked_size) both had
'< 0 || > INT_MAX' guards, but ddata[0] (sample_count_table_size)
only had '< 0'. A value > INT_MAX stored in the uint64_t field then
gets truncated to size_t on ILP32, causing an undersized allocation
followed by a heap overflow when exr_read_deep_chunk writes the full
64-bit byte count into it.

Addresses https://github.com/AcademySoftwareFoundation/openexr/security/advisories/GHSA-m5cq-cx25-qw53

Signed-off-by: Cary Phillips <cary@ilm.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cary Phillips
2026-07-14 08:38:00 -07:00
committed by GitHub
co-authored by Claude Sonnet 4.6
parent 55888dbd69
commit b2ed287077
+1 -1
View File
@@ -1006,7 +1006,7 @@ exr_read_scanline_chunk_info (
if (rv != EXR_ERR_SUCCESS) { return rv; }
priv_to_native64 (ddata, 3);
if (ddata[0] < 0)
if (ddata[0] < 0 || ddata[0] > (int64_t) INT_MAX)
{
return ctxt->print_error (
ctxt,