Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/lib/OpenEXRCore/decoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,25 @@ exr_decoding_run (
(part->storage_mode == EXR_STORAGE_DEEP_SCANLINE ||
part->storage_mode == EXR_STORAGE_DEEP_TILED))
{
if (part->comp_type == EXR_COMPRESSION_NONE &&
if (part->comp_type != EXR_COMPRESSION_NONE &&
decode->packed_sample_count_table == NULL &&
decode->sample_count_table != NULL)
{
/* A compressed deep chunk declared a zero-length (absent)
* packed sample-count table, so decompress_data() above was
* never invoked and decode->sample_count_table, which was
* allocated to hold the full decompressed table, was left
* uninitialized. Treat an absent table as all-zero sample
* counts instead of reading uninitialized heap memory in
* unpack_sample_table().
*/
memset (
decode->sample_count_table,
0,
decode->sample_count_alloc_size);
}
else if (
part->comp_type == EXR_COMPRESSION_NONE &&
decode->sample_count_table != decode->packed_sample_count_table)
{
/* Check that uncompressed data can be copied in safely.
Expand Down
Loading