Fix sprtopscreen from getting integer overflows once and for all in R_DrawRepeatMaskedColumn

Fixes TD's terminal from freezing the game this time, oh boy
This commit is contained in:
Monster Iestyn 2017-01-31 22:10:31 +00:00
parent 66a45c653a
commit 72bd3e28ed

View file

@ -708,6 +708,9 @@ static void R_DrawRepeatMaskedColumn(column_t *col)
{ {
while (sprtopscreen < sprbotscreen) { while (sprtopscreen < sprbotscreen) {
R_DrawMaskedColumn(col); R_DrawMaskedColumn(col);
if ((INT64)sprtopscreen + dc_texheight*spryscale > (INT64)INT32_MAX) // prevent overflow
sprtopscreen = INT32_MAX;
else
sprtopscreen += dc_texheight*spryscale; sprtopscreen += dc_texheight*spryscale;
} }
} }