https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412019-06-05T09:38:00Zlighty labsLighttpd - Bug #2958: lighttpd 1.4.54 segfaults on start in mod_webdavhttps://redmine.lighttpd.net/issues/2958?journal_id=117872019-06-05T09:38:00Zflynn
<ul></ul><p>Im proved stackstrace with source files:</p>
<pre>
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff71ccfa5 in buffer_is_empty (b=0x1) at buffer.h:197
197 return NULL == b || 0 == b->used;
(gdb) bt
#0 0x00007ffff71ccfa5 in buffer_is_empty (b=0x1) at buffer.h:197
#1 mod_webdav_worker_init (srv=0x5555555b3e70, p_d=<optimized out>) at mod_webdav.c:1280
#2 0x000055555556aa14 in plugins_call_worker_init (srv=0x5555555b3e70) at plugin.c:352
#3 0x0000555555560b76 in server_main (srv=<optimized out>, argc=<optimized out>, argv=<optimized out>) at server.c:1787
#4 0x0000555555561273 in main (argc=4, argv=0x7fffffffeb38) at server.c:2080
</pre> Lighttpd - Bug #2958: lighttpd 1.4.54 segfaults on start in mod_webdavhttps://redmine.lighttpd.net/issues/2958?journal_id=117882019-06-05T22:19:32Zgstrauss
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Patch Pending</i></li><li><strong>Target version</strong> changed from <i>1.4.x</i> to <i>1.4.55</i></li></ul><p>Looks like I missed converting some code from my alternate branch three years ago, where p->config_storage was <code>(plugin_config *)</code> not <code>(plugin_config **)</code> as it is in lighttpd 1.4.</p>
<p>This should fix it. I will test later this evening.</p>
<pre>
--- a/src/mod_webdav.c
+++ b/src/mod_webdav.c
@@ -1276,7 +1276,8 @@ SERVER_FUNC(mod_webdav_worker_init)
*/
plugin_data * const p = (plugin_data *)p_d;
plugin_config *s = p->config_storage[0];
- for (int n_context = p->nconfig+1; --n_context; ++s) {
+ const int n_context = p->nconfig;
+ for (int i = 0; i < n_context; ++i) {
if (!buffer_is_empty(s->sqlite_db_name)
&& mod_webdav_sqlite3_prep(s->sql, s->sqlite_db_name, srv->errh)
== HANDLER_ERROR)
</pre> Lighttpd - Bug #2958: lighttpd 1.4.54 segfaults on start in mod_webdavhttps://redmine.lighttpd.net/issues/2958?journal_id=117902019-06-06T03:56:57Zgstrauss
<ul></ul><p>The above patch is incorrect and won't process webdav directives which are not in the global scope. Here is a patch that will.</p>
<pre>
--- a/src/mod_webdav.c
+++ b/src/mod_webdav.c
@@ -1275,8 +1275,8 @@ SERVER_FUNC(mod_webdav_worker_init)
* across a fork() system call into the child process.
*/
plugin_data * const p = (plugin_data *)p_d;
- plugin_config *s = p->config_storage[0];
- for (int n_context = p->nconfig+1; --n_context; ++s) {
+ for (int i = 0; i < p->nconfig; ++i) {
+ plugin_config *s = p->config_storage[i];
if (!buffer_is_empty(s->sqlite_db_name)
&& mod_webdav_sqlite3_prep(s->sql, s->sqlite_db_name, srv->errh)
== HANDLER_ERROR)
</pre> Lighttpd - Bug #2958: lighttpd 1.4.54 segfaults on start in mod_webdavhttps://redmine.lighttpd.net/issues/2958?journal_id=117922019-06-06T06:55:43Zgstrauss
<ul><li><strong>Status</strong> changed from <i>Patch Pending</i> to <i>Fixed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset <a class="changeset" title="[mod_webdav] fix startup crash w/ multiple conds (fixes #2958) (thx flynn) x-ref: "lighttpd 1..." href="https://redmine.lighttpd.net/projects/lighttpd/repository/14/revisions/075241c773931d8ed9f2cc7d60a28ce95c48d497">075241c773931d8ed9f2cc7d60a28ce95c48d497</a>.</p> Lighttpd - Bug #2958: lighttpd 1.4.54 segfaults on start in mod_webdavhttps://redmine.lighttpd.net/issues/2958?journal_id=117932019-06-06T07:28:41Zflynn
<ul></ul><p>I tested this patch and lighttpd starts now with webdav module.</p>
<p>Litmus tests run through with one error/warning:</p>
<p>3. propfind_invalid2..... FAIL (PROPFIND with invalid namespace declaration in body (see FAQ) got 207 response not 400)</p> Lighttpd - Bug #2958: lighttpd 1.4.54 segfaults on start in mod_webdavhttps://redmine.lighttpd.net/issues/2958?journal_id=117942019-06-06T07:52:14Zgstrauss
<ul></ul><p>flynn, that is explained in the lighttpd documentation for mod_webdav <a class="wiki-page" href="https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModWebdav#litmus-tests">litmus tests</a></p> Lighttpd - Bug #2958: lighttpd 1.4.54 segfaults on start in mod_webdavhttps://redmine.lighttpd.net/issues/2958?journal_id=119082019-11-25T13:16:02Zgstrauss
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-1 status-10 priority-4 priority-default closed" href="/issues/2993">Bug #2993</a>: segmentation fault with 8 $HTTP["url"] and mod_webdav</i> added</li></ul>