From 444b11b1bb7cc01cc26cdd61247eda536c2cb7d5 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sat, 13 May 2017 23:29:35 -0500 Subject: 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. --- engines/sci/parser/vocabulary.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'engines') 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: -- cgit v1.2.3