mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
DREAMWEB: Avoid out of bound read with empty strings in printDirect
In the French version of the game, right at the start (in the first scene) there was a crash due to an out of bound read with a string of length 1 (empty, with only the '\0' character). This commit moves reading the next character to after checking that that the character is not '\0' to avoid this out of bound read. This fixes bug #15546.
This commit is contained in:
1 parent
6f4ffe3b06
commit
826660b92a
1 file changed
+2
-2
@@ -138,11 +138,11 @@ uint8 DreamWebEngine::printDirect(const uint8** string, uint16 x, uint16 *y, uin
|
||||
uint16 i = offset;
|
||||
do {
|
||||
uint8 c = (*string)[0];
|
||||
uint8 nextChar = (*string)[1];
|
||||
++(*string);
|
||||
if ((c == 0) || (c == ':')) {
|
||||
return c;
|
||||
}
|
||||
uint8 nextChar = (*string)[1];
|
||||
++(*string);
|
||||
c = modifyChar(c);
|
||||
uint8 width, height;
|
||||
printChar(charSet, &i, *y, c, nextChar, &width, &height);
|
||||
|
||||
Reference in new issue
Block a user