Skip to content

Commit

Permalink
- fixed buffer size checks for raw textures.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Jan 7, 2023
1 parent 0e5c6e3 commit 4e4642d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/common/textures/formats/rawpagetexture.cpp
Expand Up @@ -94,23 +94,23 @@ bool CheckIfRaw(FileReader & data, int desiredsize)
{
gapAtStart = false;
}
else if (ofs >= 64000-1) // Need one byte for an empty column
else if (ofs >= desiredsize-1) // Need one byte for an empty column
{
return true;
}
else
{
// Ensure this column does not extend beyond the end of the patch
const uint8_t *foo2 = (const uint8_t *)foo;
while (ofs < 64000)
while (ofs < desiredsize)
{
if (foo2[ofs] == 255)
{
return true;
}
ofs += foo2[ofs+1] + 4;
}
if (ofs >= 64000)
if (ofs >= desiredsize)
{
return true;
}
Expand Down

0 comments on commit 4e4642d

Please sign in to comment.