forked from pool/perl-XML-LibXML
- 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. OBS-URL: https://build.opensuse.org/request/show/122259 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-XML-LibXML?expand=0&rev=36
34 lines
1.0 KiB
Diff
34 lines
1.0 KiB
Diff
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
|
|
--- a/LibXML.xs
|
|
+++ b/LibXML.xs
|
|
@@ -2930,13 +2930,13 @@ toStringHTML(self)
|
|
XML::LibXML::Document::serialize_html = 1
|
|
PREINIT:
|
|
xmlChar *result=NULL;
|
|
- STRLEN len = 0;
|
|
+ int len = 0;
|
|
PREINIT_SAVED_ERROR
|
|
CODE:
|
|
PERL_UNUSED_VAR(ix);
|
|
xs_warn( "use no formated toString!" );
|
|
INIT_ERROR_HANDLER;
|
|
- htmlDocDumpMemory(self, &result, (int*)&len);
|
|
+ htmlDocDumpMemory(self, &result, &len);
|
|
CLEANUP_ERROR_HANDLER;
|
|
REPORT_ERROR(0);
|
|
|
|
--
|
|
1.7.10
|