From cc8d278d2737f55ac2ef262c89849597c5929f90 Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Mon, 30 Jul 2018 15:08:10 +0300 Subject: [PATCH] tree_to_callback: don't check document nodes for void elements walk_tree() will call this with PHG_ELEMENT_END for both document and element nodes, but only the latter ones have tag types defined. This fixes test failures seen on 32-bit big endian systems such as mips and powerpc, when a document node happened to have a valid (void) tag code at the same offset, triggering an early return. Bug-Debian: https://bugs.debian.org/904914 --- lib/HTML/Gumbo.xs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/HTML/Gumbo.xs b/lib/HTML/Gumbo.xs index b7613a6..97dfc43 100644 --- a/lib/HTML/Gumbo.xs +++ b/lib/HTML/Gumbo.xs @@ -401,7 +401,7 @@ tree_to_callback(pTHX_ PerlHtmlGumboType type, GumboNode* node, void* ctx) { dSP; SV* cb = (SV*) ctx; - if ( type == PHG_ELEMENT_END && PHG_IS_VOID_ELEMENT(node->v.element.tag) ) + if ( type == PHG_ELEMENT_END && node->type == GUMBO_NODE_ELEMENT && PHG_IS_VOID_ELEMENT(node->v.element.tag) ) return; ENTER;