engine.c: prevent an oob read in drawsprite_classic() w/ floor-aligned sprites.

git-svn-id: https://svn.eduke32.com/eduke32@4726 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-11-06 23:43:50 +00:00
parent 232e479380
commit 737af0387e

View file

@ -6384,6 +6384,12 @@ draw_as_face_sprite:
lx = ((lmax+65535)>>16);
rx = ((rmax+65535)>>16);
// OOB prevention. Simple test case: have a floor-aligned sprite to the
// right of the player. Slowly rotate right toward it. When it just
// becomes visible, the condition rx == xdim can occur.
rx = min(rx, xdim-1);
for (x=lx; x<=rx; x++)
{
uwall[x] = max(uwall[x],startumost[x+windowx1]-windowy1);