[Scummvm-git-logs] scummvm master -> 8c05a3e1513eb12ad28f51edfe5c2d7bd7c01e60
scemino
noreply at scummvm.org
Mon May 6 08:06:50 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8c05a3e151 TWP: Fix out-of-bounds read in twp.
Commit: 8c05a3e1513eb12ad28f51edfe5c2d7bd7c01e60
https://github.com/scummvm/scummvm/commit/8c05a3e1513eb12ad28f51edfe5c2d7bd7c01e60
Author: scemino (scemino74 at gmail.com)
Date: 2024-05-06T10:06:36+02:00
Commit Message:
TWP: Fix out-of-bounds read in twp.
Coverity CID 1544866
Changed paths:
engines/twp/twp.cpp
diff --git a/engines/twp/twp.cpp b/engines/twp/twp.cpp
index 013009caf03..3d6740fa760 100644
--- a/engines/twp/twp.cpp
+++ b/engines/twp/twp.cpp
@@ -982,29 +982,23 @@ static void selectVerbInventory(int direction) {
switch (direction) {
case 0: // Left
- {
- if (id < 4)
- break;
- id -= 3;
- } break;
+ if (id >= 4)
+ id -= 3;
+ break;
case 1: // Right
- {
if (id > 6) {
moveCursorTo(g_twp->screenToWin(g_twp->_uiInv.getPos(id == 7 ? 0 : 4)));
return;
}
id += 3;
- } break;
+ break;
case 2: // Up
- {
- if ((id % 3) == 1)
- break;
- id--;
- } break;
+ if ((id % 3) != 1)
+ id--;
+ break;
case 3: // Down
- if ((id % 3) == 0)
- break;
- id++;
+ if ((id % 3) != 0)
+ id++;
break;
}
More information about the Scummvm-git-logs
mailing list