* 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.
This commit is contained in:
Paul Eggert 2014-07-31 06:55:12 -07:00
parent def546a8b8
commit f3655f35cc
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2014-07-31 Paul Eggert <eggert@cs.ucla.edu>
* 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 <dmantipov@yandex.ru>
* xrdb.c (x_load_resources) [USE_MOTIF]: Although not strictly

View file

@ -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