From 054ad9b65e074899c82e75cfc6623cfe29ab1fea Mon Sep 17 00:00:00 2001
From: Fan Xin <fan.xin@jp.fujitsu.com>
Date: Tue, 6 Jun 2017 15:57:52 +0900
Subject: [PATCH] Cairo: Fix Denial-of-Service Attack due to Logical Problem in
 Program

https://bugs.freedesktop.org/show_bug.cgi?id=100763

CVE: CVE-2017-7475
Upstream-Status: Submitted [https://gitlab.freedesktop.org/cairo/cairo/-/issues/80]

Signed-off-by: Fan Xin <fan.xin@jp.fujitsu.com>
---
 src/cairo-ft-font.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index b5d08ee..5e20ae1 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1220,7 +1220,7 @@ _get_bitmap_surface (FT_Bitmap		     *bitmap,
     width = bitmap->width;
     height = bitmap->rows;
 
-    if (width == 0 || height == 0) {
+    if (width == 0 || height == 0 || bitmap->buffer == NULL) {
 	*surface = (cairo_image_surface_t *)
 	    cairo_image_surface_create_for_data (NULL, format, 0, 0, 0);
 	return (*surface)->base.status;
