xserver/hw
Alan Coopersmith de6f92513b Limit the number of screens Xvfb will attempt to allocate memory for
Commit f9e3a2955d removing the MAXSCREEN limit left the screen
number too unlimited, and allowed any positive int for a screen number:

Xvfb :1 -screen 2147483647 1024x1024x8

Fatal server error:
Not enough memory for screen 2147483647

Found by Parfait 0.3.7:
Error: Integer overflow (CWE 190)
   Integer parameter of memory allocation function realloc() may overflow due to multiplication with constant value 1112
        at line 293 of hw/vfb/InitOutput.c in function 'ddxProcessArgument'.

Since the X11 connection setup only has a CARD8 for number of SCREENS,
limit to 255 screens, which is also low enough to avoid overflow on the
sizeof(*vfbScreens) * (screenNum + 1) calculation for realloc.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
(cherry picked from commit feebf67463)
2012-01-18 11:17:02 -08:00
..
dmx dmx: Build fix for -Werror=implicit-function-declaration 2012-01-18 11:12:36 -08:00
kdrive Xephyr/dri: register screen and window privates on init 2011-08-10 14:58:29 -07:00
vfb Limit the number of screens Xvfb will attempt to allocate memory for 2012-01-18 11:17:02 -08:00
xfree86 Fix vesa's VBE PanelID interpretation 2012-01-18 11:12:48 -08:00
xnest Xnest: Match the host's keymap 2011-10-26 00:49:28 -07:00
xquartz XQuartz: appledri: Correct byte swapping in event notifications 2011-10-29 00:08:49 -07:00
xwin XWin: windowswm: Correct byte swapping in event notifications 2011-10-29 00:08:55 -07:00
Makefile.am Catch errors in recursive relink targets 2010-03-22 00:45:57 -05:00