mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-06 18:00:44 +00:00
DIRECTOR: LINGO: Fix constant size check
This commit is contained in:
parent
e8ad1bdec5
commit
329b77bd82
@ -494,14 +494,14 @@ void Lingo::addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType ty
|
|||||||
constant.type = STRING;
|
constant.type = STRING;
|
||||||
constant.u.s = new Common::String();
|
constant.u.s = new Common::String();
|
||||||
uint32 pointer = value;
|
uint32 pointer = value;
|
||||||
if (pointer + 4 >= constsStoreSize) {
|
if (pointer + 4 > constsStoreSize) {
|
||||||
error("Constant string is too small");
|
error("Constant string is too small");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uint32 length = READ_BE_UINT32(&constsStore[pointer]);
|
uint32 length = READ_BE_UINT32(&constsStore[pointer]);
|
||||||
pointer += 4;
|
pointer += 4;
|
||||||
uint32 end = pointer + length;
|
uint32 end = pointer + length;
|
||||||
if (end >= constsStoreSize) {
|
if (end > constsStoreSize) {
|
||||||
error("Constant string is too large");
|
error("Constant string is too large");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -515,7 +515,7 @@ void Lingo::addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType ty
|
|||||||
}
|
}
|
||||||
pointer += 1;
|
pointer += 1;
|
||||||
}
|
}
|
||||||
if (pointer >= constsStoreSize) {
|
if (pointer > constsStoreSize) {
|
||||||
warning("Constant string has no null terminator");
|
warning("Constant string has no null terminator");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user