]> git.sesse.net Git - vlc/commitdiff
Fix texture cache accesses in opengl
authorLaurent Aimar <fenrir@videolan.org>
Tue, 13 Sep 2011 20:37:42 +0000 (22:37 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 13 Sep 2011 20:52:55 +0000 (22:52 +0200)
It fixes a potential out of bound access.

modules/video_output/opengl.c

index 236b0d2bd7b0649b508ba350abff615ebcf86053..bc18a4a55c81ee7d5807f56febb914943cd40db5 100644 (file)
@@ -628,13 +628,13 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
 
             glr->texture = 0;
             for (int j = 0; j < last_count; j++) {
-                if (last[i].texture &&
-                    last[i].width  == glr->width &&
-                    last[i].height == glr->height &&
-                    last[i].format == glr->format &&
-                    last[i].type   == glr->type) {
-                    glr->texture = last[i].texture;
-                    memset(&last[i], 0, sizeof(last[i]));
+                if (last[j].texture &&
+                    last[j].width  == glr->width &&
+                    last[j].height == glr->height &&
+                    last[j].format == glr->format &&
+                    last[j].type   == glr->type) {
+                    glr->texture = last[j].texture;
+                    memset(&last[j], 0, sizeof(last[j]));
                     break;
                 }
             }