mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 14:50:17 +00:00
CGE2: Fix heap buffer overflow
This was reported by address-sanitizer. When the command is kCmdGhost, the Sprite pointer is not a valid sprite, and trying to access its content causes a buffer overflow. In normal usage it was not causing issues as while it reads some random values in memory, this was then ignore.
This commit is contained in:
parent
1ac7d01101
commit
fc024141b7
@ -103,7 +103,7 @@ void CommandHandler::runCommand() {
|
||||
spr = (tailCmd._ref < 0) ? ((Sprite *)tailCmd._spritePtr) : _vm->locate(tailCmd._ref);
|
||||
|
||||
Common::String sprStr;
|
||||
if (spr && *spr->_file && (tailCmd._commandType != kCmdGhost))
|
||||
if (tailCmd._commandType != kCmdGhost && spr && *spr->_file)
|
||||
// In case of kCmdGhost _spritePtr stores a pointer to a Bitmap, not to a Sprite...
|
||||
sprStr = Common::String(spr->_file);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user