44 lines
1.4 KiB
Diff
44 lines
1.4 KiB
Diff
|
From 6333e4fefb5c41971ca0d4bf97648f21b693e8f7 Mon Sep 17 00:00:00 2001
|
||
|
From: Christoph Oelckers <coelckers@users.noreply.github.com>
|
||
|
Date: Sat, 7 Jan 2023 16:15:32 +0100
|
||
|
Subject: [PATCH 13/51] - fixed buffer size checks for raw textures.
|
||
|
|
||
|
---
|
||
|
src/common/textures/formats/rawpagetexture.cpp | 6 +++---
|
||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/src/common/textures/formats/rawpagetexture.cpp b/src/common/textures/formats/rawpagetexture.cpp
|
||
|
index 1ee29e13d..8f1a357b2 100644
|
||
|
--- a/src/common/textures/formats/rawpagetexture.cpp
|
||
|
+++ b/src/common/textures/formats/rawpagetexture.cpp
|
||
|
@@ -94,7 +94,7 @@ 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;
|
||
|
}
|
||
|
@@ -102,7 +102,7 @@ bool CheckIfRaw(FileReader & data, int desiredsize)
|
||
|
{
|
||
|
// 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)
|
||
|
{
|
||
|
@@ -110,7 +110,7 @@ bool CheckIfRaw(FileReader & data, int desiredsize)
|
||
|
}
|
||
|
ofs += foo2[ofs+1] + 4;
|
||
|
}
|
||
|
- if (ofs >= 64000)
|
||
|
+ if (ofs >= desiredsize)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
--
|
||
|
2.39.3
|
||
|
|