Skip to content

Commit 0088ccf

Browse files
committed
appsec: update vendored libxml2 from 2.15.2 to 2.15.3
1 parent 9a2b413 commit 0088ccf

6 files changed

Lines changed: 31 additions & 9 deletions

File tree

appsec/third_party/libxml2/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.15.2
1+
2.15.3

appsec/third_party/libxml2/src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,11 @@ if(LIBXML2_WITH_TESTS)
505505
endforeach()
506506
if(Threads_FOUND)
507507
foreach(TEST runtest)
508+
if(LIBXML2_WITH_ZLIB)
509+
target_link_libraries(${TEST} ZLIB::ZLIB Threads::Threads)
510+
else()
508511
target_link_libraries(${TEST} Threads::Threads)
512+
endif()
509513
endforeach()
510514
endif()
511515
add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.15.2
1+
2.15.3

appsec/third_party/libxml2/src/entities.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "private/entities.h"
3030
#include "private/error.h"
3131
#include "private/io.h"
32+
#include "private/tree.h"
3233

3334
#ifndef SIZE_MAX
3435
#define SIZE_MAX ((size_t) -1)
@@ -637,6 +638,14 @@ xmlCopyEntity(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
637638
if (cur->URI == NULL)
638639
goto error;
639640
}
641+
/* Handle XML_TEXT_NODE children for XML_ENTITY_DECL */
642+
if (ent->children != NULL) {
643+
cur->children = xmlStaticCopyNodeList(ent->children, cur->doc, (xmlNodePtr)cur);
644+
/* Update last pointers */
645+
cur->last = cur->children;
646+
while (cur->last && cur->last->next) cur->last = cur->last->next;
647+
}
648+
640649
return(cur);
641650

642651
error:

appsec/third_party/libxml2/src/parser.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7261,10 +7261,10 @@ xmlParseReference(xmlParserCtxt *ctxt) {
72617261
if ((cur->type == XML_TEXT_NODE) ||
72627262
(ctxt->options & XML_PARSE_NOCDATA)) {
72637263
if (ctxt->sax->characters != NULL)
7264-
ctxt->sax->characters(ctxt, cur->content, len);
7264+
ctxt->sax->characters(ctxt->userData, cur->content, len);
72657265
} else {
72667266
if (ctxt->sax->cdataBlock != NULL)
7267-
ctxt->sax->cdataBlock(ctxt, cur->content, len);
7267+
ctxt->sax->cdataBlock(ctxt->userData, cur->content, len);
72687268
}
72697269

72707270
cur = cur->next;
@@ -7284,10 +7284,12 @@ xmlParseReference(xmlParserCtxt *ctxt) {
72847284
if ((cur->type == XML_TEXT_NODE) ||
72857285
(ctxt->options & XML_PARSE_NOCDATA)) {
72867286
if (ctxt->sax->characters != NULL)
7287-
ctxt->sax->characters(ctxt, cur->content, len);
7287+
ctxt->sax->characters(ctxt->userData, cur->content,
7288+
len);
72887289
} else {
72897290
if (ctxt->sax->cdataBlock != NULL)
7290-
ctxt->sax->cdataBlock(ctxt, cur->content, len);
7291+
ctxt->sax->cdataBlock(ctxt->userData, cur->content,
7292+
len);
72917293
}
72927294

72937295
break;

appsec/third_party/libxml2/src/xmlstring.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,14 +426,21 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) {
426426

427427
if ((add == NULL) || (len == 0))
428428
return(cur);
429-
if (len < 0)
430-
return(NULL);
429+
430+
if (len < 0) {
431+
if (cur != NULL)
432+
xmlFree(cur);
433+
return(NULL);
434+
}
435+
431436
if (cur == NULL)
432437
return(xmlStrndup(add, len));
433438

434439
size = xmlStrlen(cur);
435-
if ((size < 0) || (size > INT_MAX - len))
440+
if ((size < 0) || (size > INT_MAX - len)) {
441+
xmlFree(cur);
436442
return(NULL);
443+
}
437444
ret = (xmlChar *) xmlRealloc(cur, (size_t) size + len + 1);
438445
if (ret == NULL) {
439446
xmlFree(cur);

0 commit comments

Comments
 (0)