evas - sw render - protect against null pointer surface access
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 10 Jan 2014 03:47:27 +0000 (12:47 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 10 Jan 2014 03:47:27 +0000 (12:47 +0900)
src/lib/evas/common/evas_blit_main.c
src/lib/evas/common/evas_font_draw.c
src/lib/evas/common/evas_image_main.c
src/lib/evas/common/evas_line_main.c
src/lib/evas/common/evas_map_image.c
src/lib/evas/common/evas_polygon_main.c
src/lib/evas/common/evas_rectangle_main.c
src/lib/evas/common/evas_scale_sample.c
src/lib/evas/common/evas_scale_smooth_scaler.c

index 2daaab9..287faa3 100644 (file)
@@ -35,6 +35,7 @@ evas_common_blit_rectangle(const RGBA_Image *src, RGBA_Image *dst, int src_x, in
    Gfx_Func_Copy func;
    DATA32 *src_ptr, *dst_ptr;
 
+   if ((!src->image.data) || (!dst->image.data)) return;
    /* clip clip clip */
    if (w <= 0) return;
    if (src_x + w > (int)src->cache_entry.w) w = src->cache_entry.w - src_x;
index 3a999ff..a8174f0 100644 (file)
@@ -39,6 +39,7 @@ evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
    DATA32 *im;
    Evas_Glyph *glyph;
 
+   if (!dst->image.data) return EINA_FALSE;
    if (!glyphs) return EINA_FALSE;
    if (!glyphs->array) return EINA_FALSE;
 
index e27ed91..e41fab8 100644 (file)
@@ -401,7 +401,8 @@ _evas_common_rgba_image_post_surface(Image_Entry *ie)
 # ifdef PIXMAN_IMAGE   
    RGBA_Image *im = (RGBA_Image *)ie;
    int w, h;
-   
+
+   if (!im->image.data) return;
    if (im->pixman.im) pixman_image_unref(im->pixman.im);
    w = ie->allocated.w;
    h = ie->allocated.h;
index d3abf1a..8f4d160 100644 (file)
@@ -30,6 +30,7 @@ _evas_draw_point(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y)
 {
    RGBA_Gfx_Pt_Func pfunc;
 
+   if (!dst->image.data) return;
    if (!IN_RANGE(x, y, dst->cache_entry.w, dst->cache_entry.h))
        return;
    if ((dc->clip.use) && (!IN_RECT(x, y, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h)))
@@ -60,6 +61,7 @@ evas_common_line_point_draw(RGBA_Image *dst, int clip_x, int clip_y, int clip_w,
    Eina_Bool no_cuse;
    RGBA_Gfx_Pt_Func pfunc;
 
+   if (!dst->image.data) return;
    no_cuse = ((clip_x == 0) && (clip_y == 0) &&
               ((clip_w == (int)dst->cache_entry.w) &&
                (clip_h == (int)dst->cache_entry.h)));
index 5b9d5f7..065b28f 100644 (file)
@@ -784,7 +784,7 @@ evas_common_map_rgba_cb(RGBA_Image *src, RGBA_Image *dst,
      }
 
    evas_common_image_colorspace_normalize(src);
-   if (!src->image.data) return;
+   if ((!src->image.data) || (!dst->image.data)) return;
 
    if ((!dc->cutout.rects) && (!dc->clip.use))
      {
@@ -832,7 +832,7 @@ evas_common_map_thread_rgba_cb(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Conte
 
    evas_common_image_colorspace_normalize(src);
 
-   if (!src->image.data) return EINA_FALSE;
+   if ((!src->image.data) || (!dst->image.data)) return EINA_FALSE;
 
    if ((!dc->cutout.rects) && (!dc->clip.use))
      {
index 52dd180..2d14e8d 100644 (file)
@@ -137,6 +137,7 @@ evas_common_polygon_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Po
    int                ext_x, ext_y, ext_w, ext_h;
    int               *sorted_index;
 
+   if (!dst->image.data) return;
 #ifdef HAVE_PIXMAN
 # ifdef PIXMAN_POLY
    pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY
@@ -325,6 +326,7 @@ evas_common_polygon_rgba_draw(RGBA_Image *dst, int ext_x, int ext_y, int ext_w,
    int                yy0, yy1, yi;
    int               *sorted_index;
 
+   if (!dst->image.data) return;
    if ((ext_w <= 0) || (ext_h <= 0)) return;
 
    evas_common_cpu_end_opt();
index 28387b3..aa4f936 100644 (file)
@@ -111,6 +111,7 @@ rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, in
    int yy;
    DATA32 *ptr;
 
+   if (!dst->image.data) return;
    RECTS_CLIP_TO_RECT(x, y, w, h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
    if ((w <= 0) || (h <= 0)) return;
 
index 6aaa902..365b6ac 100644 (file)
@@ -70,6 +70,7 @@ evas_common_scale_rgba_sample_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
    int      src_w, src_h, dst_w, dst_h;
    RGBA_Gfx_Func func;
 
+   if ((!src->image.data) || (!dst->image.data)) return;
    if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h,
                          0, 0, dst->cache_entry.w, dst->cache_entry.h))) return;
    if (!(RECTS_INTERSECT(src_region_x, src_region_y, src_region_w, src_region_h,
index a97faee..67dd1d6 100644 (file)
@@ -4,6 +4,7 @@ SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int
    DATA32  *dst_ptr;
    int      src_w, src_h, dst_w, dst_h;
 
+   if ((!src->image.data) || (!dst->image.data)) return;
    if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h,
                          0, 0, dst->cache_entry.w, dst->cache_entry.h))) return;
    if (!(RECTS_INTERSECT(src_region_x, src_region_y, src_region_w, src_region_h,