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 320540 - bad xmlFree in libxslt Python accessor functions - memory corruption, segfaults
bad xmlFree in libxslt Python accessor functions - memory corruption, segfaults
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-11-02 18:30 UTC by Mike Hommey
Modified: 2006-10-12 08:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mike Hommey 2005-11-02 18:30:41 UTC
Originally reported by: Josh Triplett <josh@freedesktop.org> in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=326982

Several Python accessor functions for string fields of libxslt
structures call libxml_xmlCharPtrWrap to wrap the 'xmlChar *' in a
Python string object, which calls xmlFree on the field after creating
the Python string from it; this leads to memory corruption and
segfaults.  The attached patch modifies the API description XML file to
mark these return values as "const xmlChar *" rather than "xmlChar *" so
that the generated accessor functions call libxml_constxmlCharPtrWrap
instead, which does not call xmlFree.

diff -Naur libxslt-1.1.14.old/python/libxslt-python-api.xml
libxslt-1.1.14/python/libxslt-python-api.xml
--- libxslt-1.1.14.old/python/libxslt-python-api.xml	2004-07-13
08:43:19.000000000 -0700
+++ libxslt-1.1.14/python/libxslt-python-api.xml	2005-09-06 15:24:56.000000000 -0700
@@ -141,22 +141,22 @@
     </function>
     <function name='xsltStylesheetGetMethod' file='python_accessor'>
       <info>Get the output method of a stylesheet</info>
-      <return type='xmlChar *' info="The output method" field="method"/>
+      <return type='const xmlChar *' info="The output method" field="method"/>
       <arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
     </function>
     <function name='xsltStylesheetGetMethodURI' file='python_accessor'>
       <info>Get the output method URI of a stylesheet</info>
-      <return type='xmlChar *' info="The output method URI" field="methodURI"/>
+      <return type='const xmlChar *' info="The output method URI"
field="methodURI"/>
       <arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
     </function>
     <function name='xsltStylesheetGetVersion' file='python_accessor'>
       <info>Get the output version of a stylesheet</info>
-      <return type='xmlChar *' info="The output version" field="version"/>
+      <return type='const xmlChar *' info="The output version" field="version"/>
       <arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
     </function>
     <function name='xsltStylesheetGetEncoding' file='python_accessor'>
       <info>Get the output encoding of a stylesheet</info>
-      <return type='xmlChar *' info="The output encoding" field="encoding"/>
+      <return type='const xmlChar *' info="The output encoding" field="encoding"/>
       <arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
     </function>
     <function name='xsltStylesheetGetDoctypePublic' file='python_accessor'>
Comment 1 Mike Hommey 2006-08-21 18:44:34 UTC
hello ?
Comment 2 Mike Hommey 2006-10-02 15:52:38 UTC
is it going to be fixed ?
Comment 3 Daniel Veillard 2006-10-02 16:46:05 UTC
very likely, I just didn't remember about it, adding the patch as an attachement
would make more obvious that a patch is available, and hence easilly fixeable.
Looked at it briefly, yes that's right, and need fixing, and the patch looks just
fine.

Daniel
Comment 4 Daniel Veillard 2006-10-11 21:20:30 UTC
Okay, done, it's commited in CVS,

  thanks !

Daniel