Opened 12 years ago
Closed 12 years ago
#4209 closed defect (fixed)
segfault when config XML doesn't exist
Reported by: | ezequiel | Owned by: | tbonfort |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | MapCache | Version: | svn-trunk (development) |
Severity: | major | Keywords: | segfault, mapcache, config, msising |
Cc: |
Description
Greetings... I've just been trying mapcache from trunk (r13163) and found that, if the config file passed does not exist, it makes the server crash (more troublesome if what crashes is the apache module on a restart!).
with gdb, using environment variable MAPCACHE_CONFIG_FILE
, compiled with CFLAGS="-O2 -ggdb -pipe"
, debian wheezy, and configure ./configure --enable-debug --prefix=/opt/qrms/mapcache --disable-module --enable-memcache --enable-tiff-write-support --with-geotiff --with-gdal --with-geos
:
#0 0x00007ffff72e1b4a in apr_pvsprintf () from /usr/lib/libapr-1.so.0 #1 0x00007ffff7bcaa10 in _mapcache_context_set_error_default (ctx=0x6071d0, code=500, msg=0x402752 "failed to open config file %s") at util.c:176 #2 0x0000000000401c74 in load_config (ctx=0x6071d0, filename=0x7fffffffe8f3 "/opt/qrms/wms/mapcache/mapcache.xml") at mapcache.c:160 #3 0x0000000000402125 in main (argc=1, argv=0x7fffffffe688) at mapcache.c:262
From the look of it I'm guessing some string substitution of the filename is not being replaced, which gets to the apr print, which tries to expand it and crashes by doing so without no extra string passed. It would also appear to be dangerous in case of a filename with %s
or similar patterns such as %f
.
fixed in r13164 . the changes induced by automatic reloading caused us to pass on a NULL memory pool, which of course wrecked havoc when trying to use it.