Skip to content

Commit

Permalink
better handle under/overflow of chunk table in deep tiles
Browse files Browse the repository at this point in the history
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd committed Sep 13, 2024
1 parent 3deae27 commit abd3c0a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/lib/OpenEXRCore/decoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,24 @@ exr_decoding_run (

if (decode->chunk.sample_count_table_size > 0)
{
memcpy (
decode->sample_count_table,
decode->packed_sample_count_table,
sampsize);
if (decode->chunk.sample_count_table_size < sampsize)
{
memcpy (
decode->sample_count_table,
decode->packed_sample_count_table,
decode->chunk.sample_count_table_size);
memset (
decode->sample_count_table + (decode->chunk.sample_count_table_size / sizeof(int32_t)),
0,
sampsize - decode->chunk.sample_count_table_size);
}
else
{
memcpy (
decode->sample_count_table,
decode->packed_sample_count_table,
sampsize);
}
}
else
{
Expand Down

0 comments on commit abd3c0a

Please sign in to comment.