mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-23 01:52:48 +03:00
tree: Handle predefined entities in xmlBufGetEntityRefContent
It's possible to create references to predefined entities using the tree
API. This edge case was exposed by making predefined entities const in
commit 63ce5f9a
.
This commit is contained in:
20
testparser.c
20
testparser.c
@@ -59,6 +59,25 @@ testUnsupportedEncoding(void) {
|
||||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
testNodeGetContent(void) {
|
||||
xmlDocPtr doc;
|
||||
xmlChar *content;
|
||||
int err = 0;
|
||||
|
||||
doc = xmlReadDoc(BAD_CAST "<doc/>", NULL, NULL, 0);
|
||||
xmlAddChild(doc->children, xmlNewReference(doc, BAD_CAST "lt"));
|
||||
content = xmlNodeGetContent((xmlNodePtr) doc);
|
||||
if (strcmp((char *) content, "<") != 0) {
|
||||
fprintf(stderr, "xmlNodeGetContent failed\n");
|
||||
err = 1;
|
||||
}
|
||||
xmlFree(content);
|
||||
xmlFreeDoc(doc);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
static int
|
||||
testBalancedChunk(void) {
|
||||
@@ -373,6 +392,7 @@ main(void) {
|
||||
|
||||
err |= testStandaloneWithEncoding();
|
||||
err |= testUnsupportedEncoding();
|
||||
err |= testNodeGetContent();
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
err |= testBalancedChunk();
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user