After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 310105 - segfault in nanohttp.c
segfault in nanohttp.c
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.19
Other Linux
: Normal critical
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-07-12 10:09 UTC by Peter Breitenlohner
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Peter Breitenlohner 2005-07-12 10:09:42 UTC
Run 'make check' and inspect the output (make ends with rc=0!)

A double-free bug in nanohttp.c may cause a segfault and indeed does so during
'make check':
testapi.c -> test_nanohttp() -> test_xmlNanoHTTPScanProxy()

Here a small patch fixing this:
diff -ur -N libxml2-2.6.20.orig/nanohttp.c libxml2-2.6.20/nanohttp.c
--- libxml2-2.6.20.orig/nanohttp.c      2005-04-28 11:11:05.000000000 +0200   
+++ libxml2-2.6.20/nanohttp.c   2005-07-12 00:05:14.000000000 +0200
@@ -248,8 +248,10 @@
 
 void
 xmlNanoHTTPCleanup(void) {
-    if (proxy != NULL)
+    if (proxy != NULL) {
        xmlFree(proxy);
+       proxy = NULL;
+    }
 #ifdef _WINSOCKAPI_ 
     if (initialized)
        WSACleanup();
Comment 1 Daniel Veillard 2005-07-12 11:17:55 UTC
The change makes sense, but I can't reproduce the crash, though I have run 
testapi a number of times before the release on i386, x86_64 and valgrind ...

  Anyway, applied, I will commit soon.

Daniel
Comment 2 Peter Breitenlohner 2005-07-12 13:57:29 UTC
Hi Daniel,

the reason that you couldn't reproduce the segfault from testapi might be that
we have http_proxy in the environment whereas you probably don't.

Peter
Comment 3 Daniel Veillard 2005-07-12 15:11:03 UTC
Ha ha !
Yes this makes far more sense now ! One more reason why regression
tests really need to be run as much as possible !

  Fix commited to CVS,

  thanks,

Daniel
Comment 4 Daniel Veillard 2005-09-05 09:01:14 UTC
This should be closed by release of libxml2-2.6.21,

  thanks,

Daniel