[Python-modules-team] Bug#576343: python-elementtidy: Crash when no error occures

Romain Bignon romain at peerfuse.org
Sat Apr 3 14:58:07 UTC 2010


Package: python-elementtidy
Version: 1.0-7
Severity: important
Tags: patch

When there are no errors while parsing a HTML page, the tidyBufFree()
crashes, because it tries to access to dereference the err.allocator
which is NULL.

Here is a patch to check it before calling this function.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (900, 'testing'), (800, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python-elementtidy depends on:
ii  libc6                      2.10.2-2      GNU C Library: Shared libraries
ii  libtidy-0.99-0             20091223cvs-1 HTML syntax checker and reformatte
ii  python                     2.5.4-9       An interactive high-level object-o
ii  python-support             1.0.6         automated rebuilding support for P

python-elementtidy recommends no packages.

python-elementtidy suggests no packages.

-- no debconf information
-------------- next part --------------
--- elementtidy-1.0.orig/_elementtidy.c
+++ elementtidy-1.0/_elementtidy.c
@@ -112,16 +112,16 @@
         goto error;
     }
?
-    tidyBufFree(&out);
-    tidyBufFree(&err);
+    if (out.allocator) tidyBufFree(&out);
+    if (err.allocator) tidyBufFree(&err);
?
     tidyRelease(doc);
?
     return Py_BuildValue("NN", pyout, pyerr);
?
   error:
-    tidyBufFree(&out);
-    tidyBufFree(&err);
+    if (err.allocator) tidyBufFree(&out);
+    if (err.allocator) tidyBufFree(&err);
?
     tidyRelease(doc);


More information about the Python-modules-team mailing list