Skip to content

Commit

Permalink
fix marker pointer address can be decremented by int dataSize.
Browse files Browse the repository at this point in the history
  • Loading branch information
syoyo committed Aug 3, 2023
1 parent adb31d9 commit 6e8cac3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tinyexr.h
Original file line number Diff line number Diff line change
Expand Up @@ -5818,15 +5818,20 @@ static bool ReconstructTileOffsets(OffsetData& offset_data,

} else {

if ((marker + sizeof(int)) >= (head + size)) {
if ((marker + sizeof(uint32_t)) >= (head + size)) {
return false;
}

int dataSize;
memcpy(&dataSize, marker, sizeof(int));
uint32_t dataSize;
memcpy(&dataSize, marker, sizeof(uint32_t));
tinyexr::swap4(&dataSize);
marker += sizeof(int);
marker += sizeof(uint32_t);

marker += dataSize;

if (marker >= (head + size)) {
return false;
}
}

if (!isValidTile(exr_header, offset_data,
Expand Down

0 comments on commit 6e8cac3

Please sign in to comment.