[PATCH] image: Add NULL checks for return value of _pixman_image_for_color()

江頭幸路 <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CABXrqWu8+TSmHMUChhAUvLHq=6Tq3RV6TshwmQTddPUBhpcdLA@mail.gmail.com>
This patch fixes crash in pixman_image_composite32().

-- 
.

________________________________________
The contents of this e-mail message and any attachments are confidential and are intended solely for the addressee. The information may also be legally privileged. 
This transmission is sent in trust, and the sole purpose of delivery to the intended recipient. If you have received this transmission in error, any use, reproduction or dissemination of this transmission is strictly prohibited. 
If you are not the intended recipient, please immediately notify the sender by reply e-mailer and delete this message and its attachments, if any.
Thank you for your cooperation.
________________________________________

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
0001-image-Add-NULL-checks-for-return-value-of-_pixman_im.patch (application/octet-stream, 1.5 KB)
From 7ed5b046068f07411765ac87d10cf8e0add6ce7c Mon Sep 17 00:00:00 2001
From: Koji Egashira <[email protected]>
Date: Mon, 29 Apr 2013 18:31:08 +0900
Subject: [PATCH] image: Add NULL checks for return value of _pixman_image_for_color()

This fixes crash in pixman_image_composite32().

Originally fixed by Yoshitaro Makise.
---
 src/cairo-image-compositor.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index 19372be..16e3669 100644
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -297,6 +297,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++) {
@@ -346,6 +348,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) {
@@ -498,6 +502,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) {
-- 
1.7.9
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.