evas gl common - fix possible negative array accesses if search format fails
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Tue, 12 Aug 2014 08:32:04 +0000 (17:32 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Tue, 12 Aug 2014 08:32:04 +0000 (17:32 +0900)
this should fix CID 1223506, 1223505, 1223504

src/modules/evas/engines/gl_common/evas_gl_texture.c

index ec1255c..3ce9100 100644 (file)
@@ -955,6 +955,7 @@ evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, un
    if (!tex) return NULL;
 
    lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
+   if (lformat < 0) return NULL;
    tex->pt = _pool_tex_native_new(gc, w, h,
                                   *matching_format[lformat].intformat,
                                   *matching_format[lformat].format,
@@ -978,6 +979,7 @@ evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, un
    if (!tex) return NULL;
 
    lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
+   if (lformat < 0) return NULL;
    tex->pt = _pool_tex_render_new(gc, w, h,
                                   *matching_format[lformat].intformat,
                                   *matching_format[lformat].format);
@@ -1000,7 +1002,7 @@ evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im
    if (!tex) return NULL;
 
    lformat = _evas_gl_texture_search_format(tex->alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
-
+   if (lformat < 0) return NULL;
    tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h,
                                    *matching_format[lformat].intformat,
                                    *matching_format[lformat].format);