[cairo-commit] src/cairo-image-compositor.c

Bryce Harrington bryce at kemper.freedesktop.org
Mon Mar 3 17:22:05 PST 2014


 src/cairo-image-compositor.c |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 5c9fdcb4aa9c3c32fe4760586c11924dc5fb47ef
Author: Koji Egashira <Koji.Egashira at access-company.com>
Date:   Mon Apr 29 18:31:08 2013 +0900

    image: Add NULL checks for return value of _pixman_image_for_color()
    
    This fixes crash in pixman_image_composite32().
    
    Originally fixed by Yoshitaro Makise.
    
    Reviewed-by: Bryce Harrington <b.harrington at samsung.com>
    Signed-off-by: Bryce Harrington <b.harrington at samsung.com>

diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index 0f47814..03468a6 100644
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -308,6 +308,8 @@ fill_rectangles (void			*_dst,
 	}
     } else {
 	pixman_image_t *src = _pixman_image_for_color (color);
+	if (unlikely (src == NULL))
+	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 
 	op = _pixman_operator (op);
 	for (i = 0; i < num_rects; i++) {
@@ -355,6 +357,8 @@ fill_boxes (void		*_dst,
     else
     {
 	pixman_image_t *src = _pixman_image_for_color (color);
+	if (unlikely (src == NULL))
+	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 
 	op = _pixman_operator (op);
 	for (chunk = &boxes->chunks; chunk; chunk = chunk->next) {
@@ -507,6 +511,8 @@ composite_boxes (void			*_dst,
 	    op = PIXMAN_OP_LERP_CLEAR;
 #else
 	    free_src = src = _pixman_image_for_color (CAIRO_COLOR_WHITE);
+	    if (unlikely (src == NULL))
+		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 	    op = PIXMAN_OP_OUT_REVERSE;
 #endif
 	} else if (op == CAIRO_OPERATOR_SOURCE) {


More information about the cairo-commit mailing list