Skip to content

Commit 41b4c3e

Browse files
cary-ilmpeterhillman
authored andcommitted
Report an error if a deep pixel as more than UINT_MAX samples (#2256)
Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
1 parent d2b41c8 commit 41b4c3e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/OpenEXR/ImfCompositeDeepScanLine.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ CompositeDeepScanLine::readPixels (int start, int end)
508508
num_sources[ptr] = 0;
509509
for (size_t j = 0; j < parts; j++)
510510
{
511+
if (total_sizes[ptr] > std::numeric_limits<unsigned int>::max() - counts[j][ptr])
512+
throw IEX_NAMESPACE::ArgExc (
513+
"Cannot composite scanline: pixel cannot have more than UINT_MAX samples");
514+
511515
total_sizes[ptr] += counts[j][ptr];
512516
if (counts[j][ptr] > 0) num_sources[ptr]++;
513517
}

0 commit comments

Comments
 (0)