From: YAMAMOTO Mitsuharu Date: Tue, 7 Jan 2020 03:32:42 +0000 (+0900) Subject: Avoid crash by access to cleared img->pixmap->data/img->mask->data (Bug#38774) X-Git-Tag: emacs-27.0.90~205 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=075f21c0e3f4893c07c93298368ef8ac7c9eb012;p=emacs.git 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. --- 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) {