Skip to content

Commit 310e4c8

Browse files
committed
Fix: angle could overflow to 4097
Found with AddressSanitizer.
1 parent d0bddf8 commit 310e4c8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/r_segs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ void R_RenderSegLoop (void)
260260
{
261261
// calculate texture offset
262262
angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT;
263+
angle &= 0x0FFF;
263264
texturecolumn = rw_offset-FixedMul(finetangent[angle],rw_distance);
264265
texturecolumn >>= FRACBITS;
265266
// calculate lighting

0 commit comments

Comments
 (0)