diff options
author | Colin Snover | 2017-05-13 23:29:35 -0500 |
---|---|---|
committer | Colin Snover | 2017-05-13 23:45:59 -0500 |
commit | 444b11b1bb7cc01cc26cdd61247eda536c2cb7d5 (patch) | |
tree | 8150471384814bf652fbc07f83048bb2188fbeab /engines/sci/parser/vocabulary.cpp | |
parent | 230b88bd55112d64367f69ce6a1ba1569e26e9c7 (diff) | |
download | scummvm-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/parser/vocabulary.cpp')
-rw-r--r-- | engines/sci/parser/vocabulary.cpp | 9 |
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: |