Skip to content

Commit

Permalink
Blood: Avoid OOB access in MoveDude()
Browse files Browse the repository at this point in the history
This trips UBSan in the beginning of the first level, including during the
first attract mode demo.
  • Loading branch information
Hendricks266 committed Dec 9, 2023
1 parent fb7af7d commit 9c07795
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/blood/src/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4456,7 +4456,7 @@ void MoveDude(spritetype *pSprite)
spritetype *pHitSprite = &sprite[nHitSprite];
XSPRITE *pHitXSprite = NULL;
// Should be pHitSprite here
if (pSprite->extra > 0)
if (pSprite->extra > 0 && (unsigned)pHitSprite->extra < kMaxXSprites)
pHitXSprite = &xsprite[pHitSprite->extra];
int nOwner = actSpriteOwnerToSpriteId(pHitSprite);

Expand Down

0 comments on commit 9c07795

Please sign in to comment.