Fixed bug 1403 - Creating a window with resizable flags may crash
authorSam Lantinga
Fri, 03 Feb 2012 22:24:33 -0500
changeset 6275963497e37d34
parent 6274 246cde9a6cf3
child 6276 b696a93d2848
Fixed bug 1403 - Creating a window with resizable flags may crash

jordirovira 2012-01-28 12:07:39 PST

in SDL_x11window around 520:

/* Setup the normal size hints */
if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
sizehints.min_width = sizehints.max_width = window->w;
sizehints.min_height = sizehints.max_height = window->h;
sizehints.flags = PMaxSize | PMinSize;
}
sizehints.x = window->x;
sizehints.y = window->y;
sizehints.flags |= USPosition;

the sizehints.flags member is not initizalised if it doesn't enter the
conditional. It is as easy as setting it to zero before the conditional.
src/video/x11/SDL_x11window.c
     1.1 --- a/src/video/x11/SDL_x11window.c	Tue Jan 31 21:03:35 2012 -0500
     1.2 +++ b/src/video/x11/SDL_x11window.c	Fri Feb 03 22:24:33 2012 -0500
     1.3 @@ -501,10 +501,11 @@
     1.4      }
     1.5  
     1.6      /* Setup the normal size hints */
     1.7 +    sizehints.flags = 0;
     1.8      if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
     1.9          sizehints.min_width = sizehints.max_width = window->w;
    1.10          sizehints.min_height = sizehints.max_height = window->h;
    1.11 -        sizehints.flags = PMaxSize | PMinSize;
    1.12 +        sizehints.flags |= (PMaxSize | PMinSize);
    1.13      }
    1.14      sizehints.x = window->x;
    1.15      sizehints.y = window->y;