Package: python-libxslt1
Version: 1.1.14-1
Severity: important
Tags: patch

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.

- Josh Triplett
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'>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to