Skip to content

Commit

Permalink
check 1 part files with 'nonimage' bit have type attribute (#860)
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>

Co-authored-by: Cary Phillips <cary@ilm.com>
  • Loading branch information
peterhillman and cary-ilm authored Nov 19, 2020
1 parent 467be80 commit b3392ed
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lib/OpenEXR/ImfInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,14 @@ InputFile::InputFile (const char fileName[], int numThreads):
_data->_streamData->is = is;
_data->header.readFrom (*_data->_streamData->is, _data->version);

if(isNonImage(_data->version))
{
if(!_data->header.hasType())
{
throw(IEX_NAMESPACE::InputExc("Non-image files must have a 'type' attribute"));
}
}

// fix type attribute in single part regular image types
// (may be wrong if an old version of OpenEXR converts
// a tiled image to scanline or vice versa)
Expand Down Expand Up @@ -524,6 +532,14 @@ InputFile::InputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int numThread
_data->_streamData->is = &is;
_data->header.readFrom (*_data->_streamData->is, _data->version);

if(isNonImage(_data->version))
{
if(!_data->header.hasType())
{
throw(IEX_NAMESPACE::InputExc("Non-image files must have a 'type' attribute"));
}
}

// fix type attribute in single part regular image types
// (may be wrong if an old version of OpenEXR converts
// a tiled image to scanline or vice versa)
Expand Down

0 comments on commit b3392ed

Please sign in to comment.