Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite recursion in destructor when document was read by htmlReadDoc #23

Closed
rkd77 opened this issue Jun 8, 2021 · 0 comments
Closed

Comments

@rkd77
Copy link

rkd77 commented Jun 8, 2021

#include <libxml/HTMLparser.h>
#include <libxml++/libxml++.h>
#include <string>

int
main(void)
{
        std::string text = "BLABLA";
        xmlDoc* doc = htmlReadDoc((xmlChar*)text.c_str(), NULL, NULL, HTML_PARSE_RECOVER | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING);
        // Encapsulate raw libxml document in a libxml++ wrapper
        xmlpp::Document doc1(doc);
        return 0;
}

compile as:
g++ -o test test.cpp $(pkg-config --cflags libxml++-5.0) $(pkg-config --libs libxml++-5.0)

./test segfaults

@rkd77 rkd77 changed the title Infinite loop in destructor when document was read by htmlReadDoc Infinite recursion in destructor when document was read by htmlReadDoc Jun 9, 2021
kjellahl added a commit that referenced this issue Jun 9, 2021
Documents created with htmlReadDoc() have xmlElementType ==
XML_HTML_DOCUMENT_NODE. Handle that type like the XML_DOCUMENT_NODE
type. htmlDoc* is an alias for xmlDoc*.
Fixes #23
kjellahl added a commit that referenced this issue Jun 9, 2021
Documents created with htmlReadDoc() have xmlElementType ==
XML_HTML_DOCUMENT_NODE. Handle that type like the XML_DOCUMENT_NODE
type. htmlDoc* is an alias for xmlDoc*.
Fixes #23
kjellahl added a commit that referenced this issue Jun 9, 2021
Documents created with htmlReadDoc() have xmlElementType ==
XML_HTML_DOCUMENT_NODE. Handle that type like the XML_DOCUMENT_NODE
type. htmlDoc* is an alias for xmlDoc*.
Fixes #23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant