xserver-multidpi/hw/xfree86
Ben Crocker 8b335d9068 Fix a segfault that occurs if xorg.conf.d is absent:
In InitOutput, if xf86HandleConfigFile returns CONFIG_NOFILE
(which it does if no config file or directory is present), the
autoconfig flag is set, causing xf86AutoConfig to be called
later on.

xf86AutoConfig calls xf86OutputClassDriverList via the
call tree:

xf86AutoConfig =>
  listPossibleVideoDrivers =>
    xf86PlatformMatchDriver =>
      xf86OutputClassDriverList

and xf86OutputClassDriverList attempts to traverse a linked list
that is a member of the XF86ConfigRec struct pointed to by the
global xf86configptr, which is NULL at this point because the
XF86ConfigRec struct is only allocated (by xf86readConfigFile)
AFTER the config file and directory have been successfully
opened; the CONFIG_NOFILE return from xf86HandleConfigFile
occurs BEFORE the call to xf86readConfigFile which allocates
the XF86ConfigRec struct.

Rx: In read.c (for symmetry with xf86freeConfig, which already
appears in this file), add a new function xf86allocateConfig
which tests the value of xf86configptr and, if it's NULL,
allocates the XF86ConfigRec struct and deposits the pointer
in xf86configptr.  In xf86Parser.h, add a prototype for the
new xf86allocateConfig function.

Back in read.c, #include "xf86Config.h".  In xf86readConfigFile,
change the open-code call to calloc to a call to the new
xf86allocateConfig function.

In xf86AutoConfig.c, add a call to the new xf86allocateConfig function
to the beginning of xf86AutoConfig to make sure the XF86ConfigRec struct
is allocated.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
2016-12-07 13:18:56 -05:00
..
common Fix a segfault that occurs if xorg.conf.d is absent: 2016-12-07 13:18:56 -05:00
ddc xfree86: small memory leaks fixes 2016-09-28 14:53:39 -04:00
dixmods glx/dri2: Don't build DRI loader if DRI2 isn't enabled 2016-10-27 14:25:42 +01:00
doc xfree86: Unexport xf86Initialising, remove xf86ServerIsInitialising 2016-04-18 11:22:58 -04:00
dri xfree86/dri: remove libdrm runtime checks 2016-10-05 14:38:13 -04:00
dri2 dri2: Sync i965_pci_ids.h from mesa 2016-11-02 13:16:53 -04:00
drivers modesetting: unifdef MODESETTING_OUTPUT_SLAVE_SUPPORT 2016-10-26 12:40:35 -04:00
exa build: Remove stale miext/cw include paths 2015-10-27 13:46:13 -04:00
fbdevhw fbdevhw: Fix a const qualifier warning 2015-09-23 15:18:24 -04:00
glamor_egl glamor: Share code for put_image handling. 2014-06-15 23:20:09 +01:00
i2c xfree86: Fix null pointer dereference 2016-09-28 14:53:39 -04:00
int10 x86emu: Change include order to avoid conflict with system header 2016-04-29 11:05:38 -04:00
loader xfree86: print the module name together with the load failure message 2016-08-24 08:30:10 +10:00
man xfree86: remove aiglx cmd/xorg.conf option 2016-10-05 14:15:52 -04:00
modes xf86RandR12: Fix XF86VidModeSetGamma triggering a BadImplementation error 2016-09-28 14:53:39 -04:00
os-support Switch poll() users to xserver_poll() 2016-07-21 15:04:36 -04:00
parser Fix a segfault that occurs if xorg.conf.d is absent: 2016-12-07 13:18:56 -05:00
ramdac ramdac: Check sPriv != NULL in xf86CheckHWCursor() 2016-10-28 08:17:21 -07:00
shadowfb Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
utils xfree86: small memory leaks fixes 2016-09-28 14:53:39 -04:00
vbe xfree86: Change VBE version early-out to 1.2. (#22672) 2016-03-14 11:44:10 -04:00
vgahw Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
x86emu x86emu: Change include order to avoid conflict with system header 2016-04-29 11:05:38 -04:00
.gitignore Xorg: Add Xorg.wrap to hw/xfree86/.gitignore 2014-04-18 11:39:16 +02:00
Makefile.am vidmode: move to a separate library of its own 2016-02-29 16:29:01 -05:00
sdksyms.sh dix: Switch to the libXfont2 API (v2) 2016-07-18 15:25:59 -04:00
xorg-wrapper.c xfree86: Xorg.wrap: Do not require root rights for cards with 0 outputs 2016-10-26 12:40:23 -04:00
Xorg.sh.in xfree86: rename Xorg.bin to Xorg 2015-01-05 09:53:58 +10:00
xorgconf.cpp xfree86: fix wrong DontZap documentation (#71113) 2014-05-24 20:02:56 +10:00