From 075f21c0e3f4893c07c93298368ef8ac7c9eb012 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Tue, 7 Jan 2020 12:32:42 +0900 Subject: [PATCH] Avoid crash by access to cleared img->pixmap->data/img->mask->data (Bug#38774) * src/image.c (prepare_image_for_display) [USE_CAIRO]: Call IMAGE_BACKGROUND and IMAGE_BACKGROUND_TRANSPARENT. --- src/image.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/image.c b/src/image.c index 5fe0d713e1b..e36253b3960 100644 --- a/src/image.c +++ b/src/image.c @@ -1242,6 +1242,10 @@ prepare_image_for_display (struct frame *f, struct image *img) if (img->cr_data == NULL || (cairo_pattern_get_type (img->cr_data) != CAIRO_PATTERN_TYPE_SURFACE)) { + /* Fill in the background/background_transparent field while + we have img->pixmap->data/img->mask->data. */ + IMAGE_BACKGROUND (img, f, img->pixmap); + IMAGE_BACKGROUND_TRANSPARENT (img, f, img->mask); cr_put_image_to_cr_data (img); if (img->cr_data == NULL) { -- 2.39.2