From 3f116d98bcc4374eec9117e0af4177c07b3a7ebd Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Mon, 27 Jan 2014 22:27:21 +0100 Subject: SCI: fix negative array access in parseNodes was used for debug command only CID 1003543 --- engines/sci/parser/vocabulary.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/parser/vocabulary.cpp b/engines/sci/parser/vocabulary.cpp index f5b79d6c5e..61659f864d 100644 --- a/engines/sci/parser/vocabulary.cpp +++ b/engines/sci/parser/vocabulary.cpp @@ -724,14 +724,13 @@ int Vocabulary::parseNodes(int *i, int *pos, int type, int nr, int argc, const c newPos = parseNodes(i, pos, nextToken, nextValue, argc, argv); + if (newPos == -1) + return -1; + if (j == 0) _parserNodes[oldPos].left = &_parserNodes[newPos]; else _parserNodes[oldPos].right = &_parserNodes[newPos]; - - - if (newPos == -1) - return -1; } const char *token = argv[(*i)++]; -- cgit v1.2.3