Subject: | [PATCH] Fix test failures on 64-bit big endian platforms |
Date: | Mon, 21 May 2012 23:14:00 +0200 |
To: | bug-xml-libxml [...] rt.cpan.org |
From: | gregor herrmann <gregoa [...] debian.org> |
In Debian we are currently applying the attached patch to XML-LibXML.
We thought you might be interested in it, too.
From 99f67c5d0e13912c824b7d93ff4303524bd9cb54 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Sun, 20 May 2012 22:32:31 +0300
Subject: [PATCH] Fix test failures on 64-bit big endian platforms
As seen in <http://bugs.debian.org/673590>, t/12html.t is crashing
on 64-bit big endian platforms with
Show quoted text
> Out of memory!
> # Looks like you planned 43 tests but ran 41.
> # Looks like your test exited with 1 just after 41.
> t/12html.t ..........................
> Dubious, test returned 1 (wstat 256, 0x100)
> Failed 2/43 subtests
STRLEN has 64 bits here and int has 32, so the (int*) cast in
XML::LibXML::Document::toStringHTML() makes htmlDocDumpMemory() store
the 32-bit length of the result into a 64-bit variable. Depending on
the endianness, it either works OK (LE) or corrupts the variable (BE)
Just use an 'int' instead, and cast it to an STRLEN later in the
newSVpvn() call.
---
LibXML.xs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/LibXML.xs b/LibXML.xs
index 8ac23bf..581cc48 100644
Thanks in advance,
gregor herrmann, Debian Perl Group
Message body is not shown because sender requested not to inline it.