Bug 5709 - Segfault when invoked with --version
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: GIT MASTER
Hardware: All All
: P3 minor
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2012-07-07 13:11 EDT by symlink
Modified: 2012-07-07 13:32:32 EDT
1 user (show)

See Also:



Description symlink 2012-07-07 13:11:49 EDT
When invoking either ioq3ded or ioquake3 with the "-v" or "--version" switch, it'll segfault.

  Starting program: /usr/games/bin/ioq3ded -v
  ioq3 1.36_SVN2299 dedicated server (Jul  7 2012)

  Program received signal SIGSEGV, Segmentation fault.
  0x000055555561e9c6 in Sys_DefaultHomePath () at code/sys/sys_unix.c:70
  70				if(com_homepath->string[0])
  (gdb) bt
  #0  0x000055555561e9c6 in Sys_DefaultHomePath () at code/sys/sys_unix.c:70
  #1  0x0000555555618823 in Sys_PIDFileName () at code/sys/sys_main.c:143
  #2  Sys_Exit (exitCode=0) at code/sys/sys_main.c:207
  #3  0x00005555556196f2 in Sys_ParseArgs (argv=0x7fffffffdfe8, 
      argc=<optimized out>) at code/sys/sys_main.c:522
  #4  main (argc=<optimized out>, argv=0x7fffffffdfe8) at code/sys/sys_main.c:608


The naive approach would be testing for "if (com_homepath && com_homepath->string[0])" in Sys_DefaultHomePath(). com_homepath is set in Com_Init(), which is called after Sys_ParseArgs() in main(). Com_Init() is also where Sys_WritePIDFile() is called, so the PID file does not yet exist when Sys_Exit() is called from Sys_ParseArgs() anyways.
Comment 1 Tim Angus 2012-07-07 13:32:32 EDT
Fixed in r2300.