From 94688a6abee76f135062ed67d4d34f34e1b28045 Mon Sep 17 00:00:00 2001
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
Date: Sun, 31 Aug 2014 03:50:10 +0900
Subject: [PATCH 1002/1003] engine/display: fix count size for sin_table
gcc49 sanitizer found the following error:
../../../hacks/glx/engine.c:659:24: runtime error: index 720 out of bounds for type 'float [720]'
../../../hacks/glx/engine.c:660:24: runtime error: index 720 out of bounds for type 'float [720]'
Since countof() is defined on the head of this source, use this
to count the size of sin_table array correctly.
---
hacks/glx/engine.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hacks/glx/engine.c b/hacks/glx/engine.c
index 9c37c8b..7e7442f 100644
--- a/hacks/glx/engine.c
+++ b/hacks/glx/engine.c
@@ -655,7 +655,7 @@ static int display(Engine *e)
/* init the ln[] matrix for speed */
if (e->ln_init == 0) {
- for (e->ln_init = 0 ; e->ln_init < 730 ; e->ln_init++) {
+ for (e->ln_init = 0 ; e->ln_init < countof(e->sin_table) ; e->ln_init++) {
zb = e->sin_table[e->ln_init];
yb = e->cos_table[e->ln_init];
/* y ordinate of piston */
--
2.1.0