From 52a6194ff6b327bcd520dc308f346d01e456b0b0 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 19 Jun 2014 07:21:07 +0400 Subject: [PATCH] * font.c (font_make_object): Avoid dangling pointer which may crash GC (Bug#17771). --- src/ChangeLog | 5 +++++ src/font.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index fb0cc471599..6869116416a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 Dmitry Antipov + + * font.c (font_make_object): Avoid dangling pointer which may + crash GC (Bug#17771). + 2014-06-18 Eli Zaretskii * image.c [5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)]: Declare the diff --git a/src/font.c b/src/font.c index b49664b5f31..afa138003f2 100644 --- a/src/font.c +++ b/src/font.c @@ -207,6 +207,9 @@ font_make_object (int size, Lisp_Object entity, int pixelsize) = (struct font *) allocate_pseudovector (size, FONT_OBJECT_MAX, PVEC_FONT); int i; + /* GC can happen before the driver is set up, + so avoid dangling pointer here (Bug#17771). */ + font->driver = NULL; XSETFONT (font_object, font); if (! NILP (entity)) -- 2.39.5