Skip to content

Commit

Permalink
fix crash with damaged EXR files (#656)
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
  • Loading branch information
peterhillman committed Feb 8, 2020
1 parent 5754217 commit 3422b34
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions OpenEXR/IlmImf/ImfScanLineInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1181,8 +1181,11 @@ ScanLineInputFile::ScanLineInputFile(InputPartData* part)
{
for (size_t i = 0; i < _data->lineBuffers.size(); i++)
{
EXRFreeAligned(_data->lineBuffers[i]->buffer);
_data->lineBuffers[i]->buffer=nullptr;
if( _data->lineBuffers[i] )
{
EXRFreeAligned(_data->lineBuffers[i]->buffer);
_data->lineBuffers[i]->buffer=nullptr;
}
}
}

Expand Down Expand Up @@ -1234,11 +1237,14 @@ ScanLineInputFile::ScanLineInputFile
{
if (!_data->memoryMapped)
{
for (size_t i = 0; i < _data->lineBuffers.size(); i++)
{
EXRFreeAligned(_data->lineBuffers[i]->buffer);
_data->lineBuffers[i]->buffer=nullptr;
}
for (size_t i = 0; i < _data->lineBuffers.size(); i++)
{
if( _data->lineBuffers[i] )
{
EXRFreeAligned(_data->lineBuffers[i]->buffer);
_data->lineBuffers[i]->buffer=nullptr;
}
}
}
}
delete _streamData;
Expand Down

0 comments on commit 3422b34

Please sign in to comment.