evas - sw render - protect against null pointer surface access

This commit is contained in:
Carsten Haitzler 2014-01-10 12:47:27 +09:00
parent e54416200b
commit 03fccbd543
9 changed files with 13 additions and 3 deletions

View 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;

View 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;

View 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;

View 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)));

View 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))
{

View 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();

View 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;

View 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,

View 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,