Fix 3d floor-related crash in software renderer

3d floors can cause the software renderer to set incorrect
sprite clipping values that trigger a buffer overflow (and
a subsequent crash) when rendering sprites. This commit
keeps the clipping values within the view area.
This commit is contained in:
Nikolay Ambartsumov 2022-02-20 05:51:00 +02:00 committed by Christoph Oelckers
parent 6caa491595
commit 85d68b30bb

View file

@ -289,6 +289,9 @@ namespace swrenderer
hzt = min(hzt, clip3DFloor.sclipTop);
}
// Make sure bottom clipping stays within the view size
botclip = min<short>(botclip, viewheight);
if (topclip >= botclip)
{
spr->Light.BaseColormap = colormap;