Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Gracefully handle nothing to do #1826

Closed
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,9 @@ void ScanLineProcess::run_fill (
int fbY,
const std::vector<DeepSlice> &filllist)
{
if (cinfo.height == 0 || cinfo.width == 0)
return;

for (auto& fills: filllist)
{
uint8_t* ptr;
Expand Down Expand Up @@ -1011,6 +1014,9 @@ void ScanLineProcess::copy_sample_count (
{
const Slice& scslice = outfb->getSampleCountSlice ();

if (cinfo.height == 0 || cinfo.width == 0)
return;

int end = cinfo.height - decoder.user_line_end_ignore;
int64_t xS = int64_t (scslice.xStride);
int64_t yS = int64_t (scslice.yStride);
Expand Down
6 changes: 6 additions & 0 deletions src/lib/OpenEXR/ImfDeepTiledInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,9 @@ void TileProcess::run_fill (
const DeepFrameBuffer *outfb, int fb_absX, int fb_absY, int t_absX, int t_absY,
const std::vector<DeepSlice> &filllist)
{
if (cinfo.height == 0 || cinfo.width == 0)
return;

for (auto& fills: filllist)
{
uint8_t* ptr;
Expand Down Expand Up @@ -1227,6 +1230,9 @@ void TileProcess::copy_sample_count (
if (s.xSampling != 1 || s.ySampling != 1)
throw IEX_NAMESPACE::ArgExc ("Tiled data should not have subsampling.");

if (cinfo.height == 0 || cinfo.width == 0)
return;

int xOffset = s.xTileCoords ? 0 : t_absX;
int yOffset = s.yTileCoords ? 0 : t_absY;

Expand Down
3 changes: 3 additions & 0 deletions src/lib/OpenEXR/ImfScanLineInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,9 @@ void ScanLineProcess::run_fill (
int fbY,
const std::vector<Slice> &filllist)
{
if (cinfo.height == 0 || cinfo.width == 0)
return;

for (auto& s: filllist)
{
uint8_t* ptr;
Expand Down
3 changes: 3 additions & 0 deletions src/lib/OpenEXR/ImfTiledInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,9 @@ void TileProcess::run_fill (
const FrameBuffer *outfb, int fb_absX, int fb_absY, int t_absX, int t_absY,
const std::vector<Slice> &filllist)
{
if (cinfo.height == 0 || cinfo.width == 0)
return;

for (auto& s: filllist)
{
uint8_t* ptr;
Expand Down
4 changes: 3 additions & 1 deletion src/lib/OpenEXRCore/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,9 @@ exr_uncompress_chunk (exr_decode_pipeline_t* decode)
if ((decode->decode_flags & EXR_DECODE_SAMPLE_DATA_ONLY)) return rv;
}

if (rv == EXR_ERR_SUCCESS)
if (rv == EXR_ERR_SUCCESS &&
decode->chunk.packed_size > 0 &&
decode->chunk.unpacked_size > 0)
rv = decompress_data (
ctxt,
part->comp_type,
Expand Down
14 changes: 11 additions & 3 deletions src/lib/OpenEXRCore/decoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ default_read_chunk (exr_decode_pipeline_t* decode)
decode->unpacked_alloc_size == 0)
decode->unpacked_buffer = NULL;

if (part->storage_mode == EXR_STORAGE_DEEP_SCANLINE ||
part->storage_mode == EXR_STORAGE_DEEP_TILED)
if ((part->storage_mode == EXR_STORAGE_DEEP_SCANLINE ||
part->storage_mode == EXR_STORAGE_DEEP_TILED) &&
decode->chunk.sample_count_table_size > 0)
{
rv = internal_decode_alloc_buffer (
decode,
Expand Down Expand Up @@ -192,7 +193,7 @@ default_read_chunk (exr_decode_pipeline_t* decode)
decode->packed_sample_count_table);
}
}
else
else if (decode->chunk.packed_size > 0)
{
rv = internal_decode_alloc_buffer (
decode,
Expand All @@ -204,6 +205,8 @@ default_read_chunk (exr_decode_pipeline_t* decode)
rv = exr_read_chunk (
ctxt, decode->part_index, &(decode->chunk), decode->packed_buffer);
}
else
rv = EXR_ERR_SUCCESS;

return rv;
}
Expand Down Expand Up @@ -310,6 +313,11 @@ exr_decoding_initialize (
}
}

// will have already been reported during header parse, but just
// stop the file from being read
if (!part->channels || part->channels->type != EXR_ATTR_CHLIST)
return EXR_ERR_INVALID_ATTR;

rv = internal_coding_fill_channel_info (
&(decode->channels),
&(decode->channel_count),
Expand Down
Loading