From 38071bc5c5d2b2543dc23b38e1b810d791bf4a26 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 4 Aug 2013 09:14:11 +0200 Subject: MORTEVIELLE: Fix out-of-bounds read This should be sufficient. At this point, cy is at most 23, and if cx is 41 it's either 23 or less than 20. That means ix is either 46 or less than 43. If it's less than 43, there is no out of bounds access, and now we look at the special case first. This was a Coverity issue, but for some reason I don't see any CID for it. --- engines/mortevielle/actions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/mortevielle/actions.cpp') diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 73d258af6c..361917d53b 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1448,7 +1448,7 @@ void MortevielleEngine::fctDiscuss() { displayQuestionText(lib[choice], 1); questionAsked[choice] = ! questionAsked[choice]; } - if ((_coreVar._availableQuestion[ix] == '*') || (ix == 46)) { + if ((ix == 46) || (_coreVar._availableQuestion[ix] == '*')) { posY = ((ix - 1) % 23) << 3; if (ix > 23) posX = 320; -- cgit v1.2.3