Skip to content

Commit

Permalink
Add error check to prevent corrupt files trying to unpack (#1224)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdt3rd authored and cary-ilm committed Jan 23, 2022
1 parent 8493a0b commit b208313
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib/OpenEXRCore/chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@ exr_read_scanline_chunk_info (
fsize);
}
}

if (cinfo->packed_size == 0 && cinfo->unpacked_size > 0)
return pctxt->report_error (
pctxt,
EXR_ERR_INVALID_ARGUMENT,
"Invalid packed size of 0");
return EXR_ERR_SUCCESS;
}

Expand Down Expand Up @@ -942,6 +948,13 @@ exr_read_tile_chunk_info (
cinfo->sample_count_data_offset = 0;
cinfo->sample_count_table_size = 0;
}

if (cinfo->packed_size == 0 && cinfo->unpacked_size > 0)
return pctxt->report_error (
pctxt,
EXR_ERR_INVALID_ARGUMENT,
"Invalid packed size of 0");

return EXR_ERR_SUCCESS;
}

Expand Down

0 comments on commit b208313

Please sign in to comment.