From f3655f35ccd5a56c158a5db399c5f168b2e928d0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 31 Jul 2014 06:55:12 -0700 Subject: [PATCH] * frame.c (x_set_frame_parameters): Don't use uninitialized locals. Without this change, the code can access the local variable 'width' even when it has not been initialized, and likewise for 'height'; in either case this leads to undefined behavior. --- src/ChangeLog | 7 +++++++ src/frame.c | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b5c9e6d6b30..985e3b33e06 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-07-31 Paul Eggert + + * frame.c (x_set_frame_parameters): Don't use uninitialized locals. + Without this change, the code can access the local variable 'width' + even when it has not been initialized, and likewise for 'height'; + in either case this leads to undefined behavior. + 2014-07-30 Dmitry Antipov * xrdb.c (x_load_resources) [USE_MOTIF]: Although not strictly diff --git a/src/frame.c b/src/frame.c index fa9bdfcd065..1b9f818292f 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3198,10 +3198,9 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) XSETFRAME (frame, f); - if ((width_change || height_change) - && (width != FRAME_TEXT_WIDTH (f) - || height != FRAME_TEXT_HEIGHT (f) - || f->new_height || f->new_width)) + if (((width_change && width != FRAME_TEXT_WIDTH (f)) + || (height_change && height != FRAME_TEXT_HEIGHT (f))) + && (f->new_height || f->new_width)) { /* If necessary provide default values for HEIGHT and WIDTH. Do that here since otherwise a size change implied by an -- 2.39.2