Skip to content

Commit bd7992d

Browse files
committed
Update to libxml2-2.13.3
1 parent 5e54af5 commit bd7992d

15 files changed

+88
-22
lines changed

NEWS

+20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
NEWS file for libxml2
22

3+
v2.13.3: Jul 24 2024
4+
5+
### Security
6+
7+
- [CVE-2024-40896] Fix XXE protection in downstream code
8+
9+
### Regressions
10+
11+
- autotools: Use AC_CHECK_DECL to check for getentropy
12+
- xinclude: Fix fallback for text includes
13+
- io: Don't call getcwd in xmlParserGetDirectory
14+
- io: Fix return value of xmlFileRead
15+
- parser: Fix error return of xmlParseBalancedChunkMemory
16+
17+
### Improvements
18+
19+
- xinclude: Set error handler when parsing text
20+
- Undeprecate xmlKeepBlanksDefault
21+
22+
323
v2.13.2: Jul 4 2024
424

525
### Regressions

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
libxml2 Windows build with Visual Studio.
44

5-
This version is libxml2-2.13.2.
5+
This version is libxml2-2.13.3.
66

77
Note that LZMA support is only available for VS2013 or later.
88

File renamed without changes.

distfiles/download.url

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.2.tar.xz
1+
https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.3.tar.xz

distfiles/libxml2-2.13.2.tar.xz

-2.46 MB
Binary file not shown.
File renamed without changes.

distfiles/libxml2-2.13.2-import.md5 distfiles/libxml2-2.13.3-import.md5

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ f437ed9058e8e5135e47c01e973376ba Copyright
22
799d00dfaca59a88a1ddcb7e564e6476 HTMLparser.c
33
24211653eb3b5d6752f5eb91d6ecc3ef HTMLtree.c
44
dd63184811cb2ff705c3e466364d3773 INSTALL
5-
fe33b193822d5fb2d92b436f2547d765 NEWS
5+
e9216f2f1d1f18c7e15bf6bf86e20c80 NEWS
66
5f32c16a4eccf442197b65fa65f3c7b8 README.libxml2.md
77
7283878f36a935a3c00df077cf45af54 SAX.c
88
f2edb7da1ddb9093de9841519b68f576 SAX2.c
@@ -33,7 +33,7 @@ bc51344e21f8d3b7f0fc93cc9d554243 include/libxml/globals.h
3333
90371c7017be1221a0c4d20089ade92a include/libxml/list.h
3434
d5c907a6d7d205e286168e007f32504c include/libxml/nanoftp.h
3535
95b1e4eadd008ebd16424f0f47213062 include/libxml/nanohttp.h
36-
731e8b4519b21e29136613b0f6c5d5b9 include/libxml/parser.h
36+
d502bff9a863243db03445264fe5dea0 include/libxml/parser.h
3737
b0d1746c566f0a4e1c368d6b1f734564 include/libxml/parserInternals.h
3838
dfa0e955ce14744df32c8a050c5ee84a include/libxml/pattern.h
3939
d752e41ee40c2b028d0adb34ffc38810 include/libxml/relaxng.h
@@ -86,7 +86,7 @@ cdbcf52ea11b6ee99454e3b9a3adeaac legacy.c
8686
62f33a8621e3442770fd15a540a7eba0 list.c
8787
040942573dbd47e7188991ab3c9c9a99 nanoftp.c
8888
4c676ca8672af9c242eab69fb9e2056f nanohttp.c
89-
53c1f20bdbb724031dadb506e6683ff2 parser.c
89+
c2cd66a9e3acf9e891a9454f5a7bc147 parser.c
9090
7a70d4383a870b265ca14cd498b37c85 parserInternals.c
9191
fc88d174a7b70de62c609c32ce3f55f8 pattern.c
9292
06b7f056c759cff032979e0075c5b318 relaxng.c
@@ -101,7 +101,7 @@ c48cacc169fbe69e961ceafbfb92ee71 testModule.c
101101
8efef0b6535d6c069678e9f6750d3742 testdict.c
102102
6a3e7cbf9864c04639a1a8ac0c388ea2 testdso.c
103103
e7f8098f4a9e147624c3cf7d652a70c0 testlimits.c
104-
6010c3c335e3369385618d022aade84a testparser.c
104+
b6224e455a78abefae0a5a1d128ed789 testparser.c
105105
71ea68a83739869caba574c1725fba96 testrecurse.c
106106
d746403de87ca28dbb43a4a76e63a3d6 threads.c
107107
1bcb15667ab695cdd2cc8d5b1bc05169 timsort.h
@@ -110,9 +110,9 @@ f8bea8ace4ec3a2d89543da6b91ab630 uri.c
110110
46d56681c3541150ee29b33f77e76bb8 valid.c
111111
8ab2045fb3bb5553449a93c85ebbb58a win32/config.h
112112
9ca0965eeabe09b4f8d9a1c6c5d8c3b0 win32/libxml2.rc
113-
a9b815153157403c75b2c9abf687e97e xinclude.c
113+
98e142c0d1c661f7604934d31f6cc0ec xinclude.c
114114
0a034450d155e35ec8ba99ee2005b695 xlink.c
115-
6fea46801cfbcfc142146f3bbf05a90b xmlIO.c
115+
c38f958da8d204477b58955c69c206a2 xmlIO.c
116116
28bb81f9966d3ec48c510dd56fa10b94 xmlcatalog.c
117117
7eeb0736114d53f08e4be4d611e579dd xmllint.c
118118
9a191c58eb3f035c795898caea8e689b xmlmemory.c

distfiles/libxml2-2.13.3.tar.xz

2.46 MB
Binary file not shown.

include/libxml/parser.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ XML_DEPRECATED XMLPUBFUN int
948948
xmlSubstituteEntitiesDefault(int val);
949949
XML_DEPRECATED XMLPUBFUN int
950950
xmlThrDefSubstituteEntitiesDefaultValue(int v);
951-
XML_DEPRECATED XMLPUBFUN int
951+
XMLPUBFUN int
952952
xmlKeepBlanksDefault (int val);
953953
XML_DEPRECATED XMLPUBFUN int
954954
xmlThrDefKeepBlanksDefaultValue(int v);

include/libxml/xmlversion.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
*
1616
* the version string like "1.2.3"
1717
*/
18-
#define LIBXML_DOTTED_VERSION "2.13.2"
18+
#define LIBXML_DOTTED_VERSION "2.13.3"
1919

2020
/**
2121
* LIBXML_VERSION:
2222
*
2323
* the version number: 1.2.3 value is 10203
2424
*/
25-
#define LIBXML_VERSION 21302
25+
#define LIBXML_VERSION 21303
2626

2727
/**
2828
* LIBXML_VERSION_STRING:
2929
*
3030
* the version number string, 1.2.3 value is "10203"
3131
*/
32-
#define LIBXML_VERSION_STRING "21302"
32+
#define LIBXML_VERSION_STRING "21303"
3333

3434
/**
3535
* LIBXML_VERSION_EXTRA:
@@ -44,7 +44,7 @@
4444
* Macro to check that the libxml version in use is compatible with
4545
* the version the software has been compiled against
4646
*/
47-
#define LIBXML_TEST_VERSION xmlCheckVersion(21302);
47+
#define LIBXML_TEST_VERSION xmlCheckVersion(21303);
4848

4949
/**
5050
* LIBXML_THREAD_ENABLED:

parser.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -7382,6 +7382,14 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
73827382
return;
73837383
}
73847384

7385+
/*
7386+
* Some users try to parse entities on their own and used to set
7387+
* the renamed "checked" member. Fix the flags to cover this
7388+
* case.
7389+
*/
7390+
if (((ent->flags & XML_ENT_PARSED) == 0) && (ent->children != NULL))
7391+
ent->flags |= XML_ENT_PARSED;
7392+
73857393
/*
73867394
* The first reference to the entity trigger a parsing phase
73877395
* where the ent->children is filled with the result from
@@ -12535,7 +12543,10 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
1253512543
else
1253612544
xmlFreeNodeList(list);
1253712545

12538-
ret = ctxt->errNo;
12546+
if (!ctxt->wellFormed)
12547+
ret = ctxt->errNo;
12548+
else
12549+
ret = XML_ERR_OK;
1253912550

1254012551
xmlFreeInputStream(input);
1254112552
xmlFreeParserCtxt(ctxt);

testparser.c

+31
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* See Copyright for the status of this software.
55
*/
66

7+
#define XML_DEPRECATED
8+
79
#include <libxml/parser.h>
810
#include <libxml/uri.h>
911
#include <libxml/xmlreader.h>
@@ -95,6 +97,34 @@ testNodeGetContent(void) {
9597
return err;
9698
}
9799

100+
static int
101+
testCFileIO(void) {
102+
xmlDocPtr doc;
103+
int err = 0;
104+
105+
/* Deprecated FILE-based API */
106+
xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen, xmlFileRead,
107+
xmlFileClose);
108+
doc = xmlReadFile("test/ent1", NULL, 0);
109+
110+
if (doc == NULL) {
111+
err = 1;
112+
} else {
113+
xmlNodePtr root = xmlDocGetRootElement(doc);
114+
115+
if (root == NULL || !xmlStrEqual(root->name, BAD_CAST "EXAMPLE"))
116+
err = 1;
117+
}
118+
119+
xmlFreeDoc(doc);
120+
xmlPopInputCallbacks();
121+
122+
if (err)
123+
fprintf(stderr, "xmlReadFile failed with FILE input callbacks\n");
124+
125+
return err;
126+
}
127+
98128
#ifdef LIBXML_SAX1_ENABLED
99129
static int
100130
testBalancedChunk(void) {
@@ -540,6 +570,7 @@ main(void) {
540570
err |= testStandaloneWithEncoding();
541571
err |= testUnsupportedEncoding();
542572
err |= testNodeGetContent();
573+
err |= testCFileIO();
543574
#ifdef LIBXML_SAX1_ENABLED
544575
err |= testBalancedChunk();
545576
#endif

win32/rcVersion.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#define LIBXML_MAJOR_VERSION 2
22
#define LIBXML_MINOR_VERSION 13
3-
#define LIBXML_MICRO_VERSION 2
4-
#define LIBXML_DOTTED_VERSION "2.13.2"
3+
#define LIBXML_MICRO_VERSION 3
4+
#define LIBXML_DOTTED_VERSION "2.13.3"

xinclude.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -1653,11 +1653,18 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, xmlXIncludeRefPtr ref) {
16531653
xmlXIncludeErrMemory(ctxt);
16541654
goto error;
16551655
}
1656+
if (ctxt->errorHandler != NULL)
1657+
xmlCtxtSetErrorHandler(pctxt, ctxt->errorHandler, ctxt->errorCtxt);
16561658
inputStream = xmlLoadExternalEntity((const char*)url, NULL, pctxt);
16571659
if (inputStream == NULL) {
1660+
/*
1661+
* ENOENT only produces a warning which isn't reflected in errNo.
1662+
*/
16581663
if (pctxt->errNo == XML_ERR_NO_MEMORY)
16591664
xmlXIncludeErrMemory(ctxt);
1660-
else
1665+
else if ((pctxt->errNo != XML_ERR_OK) &&
1666+
(pctxt->errNo != XML_IO_ENOENT) &&
1667+
(pctxt->errNo != XML_IO_UNKNOWN))
16611668
xmlXIncludeErr(ctxt, NULL, pctxt->errNo, "load error", NULL);
16621669
goto error;
16631670
}

xmlIO.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ xmlFileRead(void * context, char * buffer, int len) {
794794
if ((bytes < (size_t) len) && (ferror(file)))
795795
return(-xmlIOErr(0, "fread()"));
796796

797-
return(len);
797+
return(bytes);
798798
}
799799

800800
#ifdef LIBXML_OUTPUT_ENABLED
@@ -2922,10 +2922,7 @@ xmlParserGetDirectory(const char *filename) {
29222922
else *cur = 0;
29232923
ret = xmlMemStrdup(dir);
29242924
} else {
2925-
if (getcwd(dir, 1024) != NULL) {
2926-
dir[1023] = 0;
2927-
ret = xmlMemStrdup(dir);
2928-
}
2925+
ret = xmlMemStrdup(".");
29292926
}
29302927
return(ret);
29312928
#undef IS_XMLPGD_SEP

0 commit comments

Comments
 (0)