aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorColin Snover2017-05-13 23:29:35 -0500
committerColin Snover2017-05-13 23:45:59 -0500
commit444b11b1bb7cc01cc26cdd61247eda536c2cb7d5 (patch)
tree8150471384814bf652fbc07f83048bb2188fbeab /engines/sci
parent230b88bd55112d64367f69ce6a1ba1569e26e9c7 (diff)
downloadscummvm-rg350-444b11b1bb7cc01cc26cdd61247eda536c2cb7d5.tar.gz
scummvm-rg350-444b11b1bb7cc01cc26cdd61247eda536c2cb7d5.tar.bz2
scummvm-rg350-444b11b1bb7cc01cc26cdd61247eda536c2cb7d5.zip
SCI: Fix access violation reading Hoyle1 vocabulary
The vocab file for this game does not seem to be valid (other utilities like SV cannot parse it either), and this game does not seem to need the parser, so just exit early like the SCI1 branch when unexpectedly running out of bytes in the vocab file. Fixes Trac#9765.
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/parser/vocabulary.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/sci/parser/vocabulary.cpp b/engines/sci/parser/vocabulary.cpp
index 1f062c6363..3989f20209 100644
--- a/engines/sci/parser/vocabulary.cpp
+++ b/engines/sci/parser/vocabulary.cpp
@@ -153,11 +153,20 @@ bool Vocabulary::loadParserWords() {
}
} else {
do {
+ if (seeker == resource->size()) {
+ warning("SCI0: Vocabulary not usable, disabling");
+ return false;
+ }
c = resource->getUint8At(seeker++);
currentWord[currentWordPos++] = c & 0x7f; // 0x80 is used to terminate the string
} while (c < 0x80);
}
+ if (seeker == resource->size()) {
+ warning("Vocabulary not usable, disabling");
+ return false;
+ }
+
currentWord[currentWordPos] = 0;
// Now decode class and group: