From 8422a9720eb9b95f6726849650306eeb62adc3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Ko=C5=82odziejski?= Date: Sat, 27 Nov 2021 01:09:40 +0100 Subject: [PATCH] TINYGL: Fixed reading outside of buffer --- graphics/tinygl/api.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/graphics/tinygl/api.cpp b/graphics/tinygl/api.cpp index 27e4c95afd5..3a83c0a31fa 100644 --- a/graphics/tinygl/api.cpp +++ b/graphics/tinygl/api.cpp @@ -451,9 +451,12 @@ void tglLightfv(int light, int type, const float *v) { p[0].op = TinyGL::OP_Light; p[1].i = light; p[2].i = type; - // TODO: 3 composants - for (int i = 0; i < 4; i++) - p[3 + i].f = v[i]; + for (int i = 0; i < 4; i++) { + if (type != TGL_SPOT_DIRECTION) + p[3 + i].f = v[i]; + else + p[3 + i].f = 0.0f; + } TinyGL::gl_add_op(p); }