]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
alphashadow/lightfilter: bound the texcoords after converting to integer to guard...
authorRudolf Polzer <divverent@xonotic.org>
Tue, 18 Oct 2011 15:07:24 +0000 (17:07 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 18 Oct 2011 15:07:24 +0000 (17:07 +0200)
tools/quake3/q3map2/light_trace.c

index 84e4ab0eef12c97709e15eec8b606f3326cdfd9b..a328f4666bc619b1708178da9ea47189b6ba53b5 100644 (file)
@@ -1498,6 +1498,10 @@ qboolean TraceTriangle( traceInfo_t *ti, traceTriangle_t *tt, trace_t *trace )
        t = t - floor( t );
        is = s * si->lightImage->width;
        it = t * si->lightImage->height;
+       if(is < 0) is = 0;
+       if(is > si->lightImage->width - 1) is = si->lightImage->width - 1;
+       if(it < 0) it = 0;
+       if(it > si->lightImage->height - 1) it = si->lightImage->height - 1;
        
        /* get pixel */
        pixel = si->lightImage->pixels + 4 * (it * si->lightImage->width + is);