mathgl/mathgl-2.4.1-fix_overflow.patch

13 lines
503 B
Diff

diff -r b759fc50f42e src/pixel.cpp
--- a/src/pixel.cpp Fri Feb 16 00:41:32 2018 +0000
+++ b/src/pixel.cpp Fri Feb 16 00:42:35 2018 +0000
@@ -274,7 +274,7 @@
// if(!r) return r; // NOTE r must be provided!
if(p.a<=0) { memset(r,0,4); return r; }
float b0=0,b1=0,b2=0, ar,ag,ab,dif;
- const size_t nl = p.sub>=0?p.sub:1-p.sub;
+ const size_t nl = p.sub>=0?p.sub:-1-p.sub;
const bool glob = !get(MGL_LOCAL_LIGHT);
ar = ag = ab = glob?AmbBr:Sub[nl].AmbBr;
dif = glob?DifBr:Sub[nl].DifBr;