From 95756dbf034f6df8869ef933a8c3cc4b8a6ce162 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Wed, 3 Sep 2014 12:46:43 +0900 Subject: [PATCH] sproingies/RenderSproingie: limit shift value gcc49 sanitizer detected the following error: ../../../hacks/glx/sproingies.c:554:24: runtime error: shift exponent 32 is too large for 32-bit type 'int' This means that thisSproingie->frame - BOOM_FRAME can be no less than 32. So just clipping this value to 31 to make it sure that shift exponent is in the range for int. --- hacks/glx/sproingies.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hacks/glx/sproingies.c b/hacks/glx/sproingies.c index 0892eff..42ccf2b 100644 --- a/hacks/glx/sproingies.c +++ b/hacks/glx/sproingies.c @@ -551,7 +551,11 @@ RenderSproingie(int t, sp_instance * si) glTranslatef((GLfloat) (thisSproingie->x) + 0.5, (GLfloat) (thisSproingie->y) + 0.5, (GLfloat) (thisSproingie->z) - 0.5); - scale = (GLfloat) (1 << (thisSproingie->frame - BOOM_FRAME)); + { + int boom_scale = thisSproingie->frame - BOOM_FRAME; + if (boom_scale >= 31) boom_scale = 31; + scale = (GLfloat) (1 << boom_scale); + } glScalef(scale, scale, scale); if (!si->wireframe) { if (!si->mono) -- 1.9.3