Skip to content

Commit 3c93288

Browse files
committed
Updated libxml to 2.13.6
1 parent 894f509 commit 3c93288

30 files changed

+485
-547
lines changed

.ImageMagick/ImageMagick.version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#define DELEGATE_VERSION_NUM 2,13,5
2-
#define DELEGATE_VERSION_STRING "2.13.5 (2024-11-12)"
1+
#define DELEGATE_VERSION_NUM 2,13,6
2+
#define DELEGATE_VERSION_STRING "2.13.6 (2025-02-18)"

.gitlab-ci.yml

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
include:
2+
- component: "gitlab.gnome.org/GNOME/citemplates/release-service@master"
3+
inputs:
4+
dist-job-name: "dist"
5+
tarball-artifact-path: "libxml2-dist/libxml2-2.13.6.tar.xz"
6+
17
.test:
28
image: registry.gitlab.gnome.org/gnome/libxml2
39
variables:
@@ -286,6 +292,14 @@ cmake:linux:gcc:shared:
286292
CC: gcc
287293
SUFFIX: linux-gcc-shared
288294

295+
dist:
296+
image: registry.gitlab.gnome.org/gnome/libxml2
297+
script:
298+
- sh .gitlab-ci/dist.sh
299+
artifacts:
300+
paths:
301+
- libxml2-dist/*.tar.xz
302+
289303
pages:
290304
script:
291305
- mkdir -p public

.gitlab-ci/dist.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
mkdir -p libxml2-dist
6+
cd libxml2-dist
7+
sh ../autogen.sh
8+
make distcheck V=1 DISTCHECK_CONFIGURE_FLAGS='--with-legacy'
9+
if [ -z "$CI_COMMIT_TAG" ]; then
10+
mv libxml2-*.tar.xz libxml2-git-$CI_COMMIT_SHORT_SHA.tar.xz
11+
fi

CMakeLists.txt

+8-3
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,12 @@ if (NOT MSVC)
149149
check_function_exists(stat HAVE_STAT)
150150
check_include_files(stdint.h HAVE_STDINT_H)
151151
check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
152-
check_include_files(sys/random.h HAVE_SYS_RANDOM_H)
152+
if (APPLE)
153+
# In old macOS SDKs (ex: 10.15), sys/random.h fails to include header files it needs, so add them here.
154+
check_include_files("Availability.h;stddef.h;sys/random.h" HAVE_SYS_RANDOM_H)
155+
else()
156+
check_include_files(sys/random.h HAVE_SYS_RANDOM_H)
157+
endif()
153158
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
154159
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
155160
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
@@ -549,7 +554,7 @@ if(LIBXML2_WITH_PYTHON)
549554
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in "${LIBXML2CLASS_PY}")
550555
configure_file(${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in libxml2.py COPYONLY)
551556
add_library(
552-
LibXml2Mod
557+
LibXml2Mod SHARED
553558
libxml2-py.c
554559
libxml2-py.h
555560
python/libxml.c
@@ -611,7 +616,7 @@ install(
611616
write_basic_package_version_file(
612617
${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake
613618
VERSION ${PROJECT_VERSION}
614-
COMPATIBILITY ExactVersion
619+
COMPATIBILITY SameMajorVersion
615620
)
616621

617622
install(

NEWS

+38-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,50 @@
11
NEWS file for libxml2
22

3+
v2.13.6: Feb 18 2025
4+
5+
### Security
6+
7+
- [CVE-2025-24928] Fix stack-buffer-overflow in xmlSnprintfElements
8+
- [CVE-2024-56171] Fix use-after-free after xmlSchemaItemListAdd
9+
- pattern: Fix compilation of explicit child axis
10+
11+
### Regressions
12+
13+
- xmllint: Support compressed input from stdin
14+
- uri: Fix handling of Windows drive letters
15+
- reader: Fix return value of xmlTextReaderReadString again
16+
- SAX2: Fix xmlSAX2ResolveEntity if systemId is NULL
17+
18+
### Portability
19+
20+
- dict: Handle ENOSYS from getentropy gracefully
21+
- Fix compilation with uclibc (Dario Binacchi)
22+
- python: Declare init func with PyMODINIT_FUNC
23+
- tests: Fix sanitizer version check on old Apple clang
24+
- cmake: Work around broken sys/random.h in old macOS SDKs
25+
26+
### Build
27+
28+
- autotools: Set AC_CONFIG_AUX_DIR
29+
- cmake: Always build Python module as shared library
30+
- cmake: add missing `Bcrypt` link on Windows (Saleem Abdulrasool)
31+
- cmake: Fix compatibility in package version file
32+
33+
334
v2.13.5: Nov 12 2024
435

536
### Regressions
637

7-
- xmlIO: Fix reading from non-regular files like pipes (Nick Wellnhofer)
8-
- xmlreader: Fix return value of xmlTextReaderReadString (Nick Wellnhofer)
9-
- parser: Fix loading of parameter entities in external DTDs (Nick Wellnhofer)
10-
- parser: Fix downstream code that swaps DTDs (Nick Wellnhofer)
11-
- parser: Fix detection of duplicate attributes (Nick Wellnhofer)
12-
- string: Fix va_copy fallback (Nick Wellnhofer)
38+
- xmlIO: Fix reading from non-regular files like pipes
39+
- xmlreader: Fix return value of xmlTextReaderReadString
40+
- parser: Fix loading of parameter entities in external DTDs
41+
- parser: Fix downstream code that swaps DTDs
42+
- parser: Fix detection of duplicate attributes
43+
- string: Fix va_copy fallback
1344

1445
### Bug fixes
1546

16-
- xpath: Fix parsing of non-ASCII names (Nick Wellnhofer)
47+
- xpath: Fix parsing of non-ASCII names
1748

1849

1950
v2.13.4: Sep 18 2024

SAX2.c

+36-30
Original file line numberDiff line numberDiff line change
@@ -404,42 +404,48 @@ xmlSAX2ResolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId
404404
{
405405
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
406406
xmlParserInputPtr ret = NULL;
407-
xmlChar *URI;
408-
const xmlChar *base = NULL;
409-
int res;
407+
xmlChar *URI = NULL;
410408

411409
if (ctx == NULL) return(NULL);
412-
if (ctxt->input != NULL)
413-
base = BAD_CAST ctxt->input->filename;
414410

415-
/*
416-
* We don't really need the 'directory' struct member, but some
417-
* users set it manually to a base URI for memory streams.
418-
*/
419-
if (base == NULL)
420-
base = BAD_CAST ctxt->directory;
411+
if (systemId != NULL) {
412+
const xmlChar *base = NULL;
413+
int res;
421414

422-
if ((xmlStrlen(systemId) > XML_MAX_URI_LENGTH) ||
423-
(xmlStrlen(base) > XML_MAX_URI_LENGTH)) {
424-
xmlFatalErr(ctxt, XML_ERR_RESOURCE_LIMIT, "URI too long");
425-
return(NULL);
426-
}
427-
res = xmlBuildURISafe(systemId, base, &URI);
428-
if (URI == NULL) {
429-
if (res < 0)
430-
xmlSAX2ErrMemory(ctxt);
431-
else
432-
xmlWarnMsg(ctxt, XML_ERR_INVALID_URI,
433-
"Can't resolve URI: %s\n", systemId);
434-
return(NULL);
435-
}
436-
if (xmlStrlen(URI) > XML_MAX_URI_LENGTH) {
437-
xmlFatalErr(ctxt, XML_ERR_RESOURCE_LIMIT, "URI too long");
438-
} else {
439-
ret = xmlLoadExternalEntity((const char *) URI,
440-
(const char *) publicId, ctxt);
415+
if (ctxt->input != NULL)
416+
base = BAD_CAST ctxt->input->filename;
417+
418+
/*
419+
* We don't really need the 'directory' struct member, but some
420+
* users set it manually to a base URI for memory streams.
421+
*/
422+
if (base == NULL)
423+
base = BAD_CAST ctxt->directory;
424+
425+
if ((xmlStrlen(systemId) > XML_MAX_URI_LENGTH) ||
426+
(xmlStrlen(base) > XML_MAX_URI_LENGTH)) {
427+
xmlFatalErr(ctxt, XML_ERR_RESOURCE_LIMIT, "URI too long");
428+
return(NULL);
429+
}
430+
res = xmlBuildURISafe(systemId, base, &URI);
431+
if (URI == NULL) {
432+
if (res < 0)
433+
xmlSAX2ErrMemory(ctxt);
434+
else
435+
xmlWarnMsg(ctxt, XML_ERR_INVALID_URI,
436+
"Can't resolve URI: %s\n", systemId);
437+
return(NULL);
438+
}
439+
if (xmlStrlen(URI) > XML_MAX_URI_LENGTH) {
440+
xmlFatalErr(ctxt, XML_ERR_RESOURCE_LIMIT, "URI too long");
441+
xmlFree(URI);
442+
return(NULL);
443+
}
441444
}
442445

446+
ret = xmlLoadExternalEntity((const char *) URI,
447+
(const char *) publicId, ctxt);
448+
443449
xmlFree(URI);
444450
return(ret);
445451
}

config.h

-22
This file was deleted.

configure.ac

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ AC_PREREQ([2.63])
33

44
m4_define([MAJOR_VERSION], 2)
55
m4_define([MINOR_VERSION], 13)
6-
m4_define([MICRO_VERSION], 5)
6+
m4_define([MICRO_VERSION], 6)
77

88
AC_INIT([libxml2],[MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION])
99
AC_CONFIG_SRCDIR([entities.c])
1010
AC_CONFIG_HEADERS([config.h])
1111
AC_CONFIG_MACRO_DIR([m4])
12+
AC_CONFIG_AUX_DIR([.])
1213
AC_CANONICAL_HOST
1314

1415
LIBXML_MAJOR_VERSION=MAJOR_VERSION

dict.c

+22-11
Original file line numberDiff line numberDiff line change
@@ -928,15 +928,15 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
928928
#define WIN32_LEAN_AND_MEAN
929929
#include <windows.h>
930930
#include <bcrypt.h>
931-
#pragma comment(lib, "bcrypt.lib")
932-
#elif defined(HAVE_GETENTROPY)
933-
#ifdef HAVE_UNISTD_H
934-
#include <unistd.h>
935-
#endif
936-
#ifdef HAVE_SYS_RANDOM_H
937-
#include <sys/random.h>
938-
#endif
939931
#else
932+
#if defined(HAVE_GETENTROPY)
933+
#ifdef HAVE_UNISTD_H
934+
#include <unistd.h>
935+
#endif
936+
#ifdef HAVE_SYS_RANDOM_H
937+
#include <sys/random.h>
938+
#endif
939+
#endif
940940
#include <time.h>
941941
#endif
942942

@@ -966,9 +966,21 @@ xmlInitRandom(void) {
966966
"error code %lu\n", GetLastError());
967967
abort();
968968
}
969-
#elif defined(HAVE_GETENTROPY)
969+
#else
970+
int var;
971+
972+
#if defined(HAVE_GETENTROPY)
970973
while (1) {
971974
if (getentropy(globalRngState, sizeof(globalRngState)) == 0)
975+
return;
976+
977+
/*
978+
* This most likely means that libxml2 was compiled on
979+
* a system supporting certain system calls and is running
980+
* on a system that doesn't support these calls, as can
981+
* be the case on Linux.
982+
*/
983+
if (errno == ENOSYS)
972984
break;
973985

974986
if (errno != EINTR) {
@@ -977,8 +989,7 @@ xmlInitRandom(void) {
977989
abort();
978990
}
979991
}
980-
#else
981-
int var;
992+
#endif
982993

983994
globalRngState[0] =
984995
(unsigned) time(NULL) ^

encoding.c

+14-10
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ DECLARE_ISO_FUNCS(16)
12641264
#endif /* LIBXML_ISO8859X_ENABLED */
12651265

12661266
#ifdef LIBXML_ICONV_ENABLED
1267-
#define EMPTY_ICONV , (iconv_t) 0, (iconv_t) 0
1267+
#define EMPTY_ICONV , (iconv_t) -1, (iconv_t) -1
12681268
#else
12691269
#define EMPTY_ICONV
12701270
#endif
@@ -1389,8 +1389,8 @@ xmlNewCharEncodingHandler(const char *name,
13891389
handler->name = up;
13901390

13911391
#ifdef LIBXML_ICONV_ENABLED
1392-
handler->iconv_in = NULL;
1393-
handler->iconv_out = NULL;
1392+
handler->iconv_in = (iconv_t) -1;
1393+
handler->iconv_out = (iconv_t) -1;
13941394
#endif
13951395
#ifdef LIBXML_ICU_ENABLED
13961396
handler->uconv_in = NULL;
@@ -1641,6 +1641,10 @@ xmlCreateUconvHandler(const char *name, xmlCharEncodingHandler **out) {
16411641
}
16421642
enc->input = NULL;
16431643
enc->output = NULL;
1644+
#ifdef LIBXML_ICONV_ENABLED
1645+
enc->iconv_in = (iconv_t) -1;
1646+
enc->iconv_out = (iconv_t) -1;
1647+
#endif
16441648
enc->uconv_in = ucv_in;
16451649
enc->uconv_out = ucv_out;
16461650

@@ -2200,7 +2204,7 @@ xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
22002204
}
22012205
}
22022206
#ifdef LIBXML_ICONV_ENABLED
2203-
else if (handler->iconv_in != NULL) {
2207+
else if (handler->iconv_in != (iconv_t) -1) {
22042208
ret = xmlIconvWrapper(handler->iconv_in, out, outlen, in, inlen);
22052209
}
22062210
#endif /* LIBXML_ICONV_ENABLED */
@@ -2260,7 +2264,7 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
22602264
}
22612265
}
22622266
#ifdef LIBXML_ICONV_ENABLED
2263-
else if (handler->iconv_out != NULL) {
2267+
else if (handler->iconv_out != (iconv_t) -1) {
22642268
ret = xmlIconvWrapper(handler->iconv_out, out, outlen, in, inlen);
22652269
}
22662270
#endif /* LIBXML_ICONV_ENABLED */
@@ -2672,17 +2676,17 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
26722676
* Iconv handlers can be used only once, free the whole block.
26732677
* and the associated icon resources.
26742678
*/
2675-
if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) {
2679+
if ((handler->iconv_out != (iconv_t) -1) || (handler->iconv_in != (iconv_t) -1)) {
26762680
tofree = 1;
2677-
if (handler->iconv_out != NULL) {
2681+
if (handler->iconv_out != (iconv_t) -1) {
26782682
if (iconv_close(handler->iconv_out))
26792683
ret = -1;
2680-
handler->iconv_out = NULL;
2684+
handler->iconv_out = (iconv_t) -1;
26812685
}
2682-
if (handler->iconv_in != NULL) {
2686+
if (handler->iconv_in != (iconv_t) -1) {
26832687
if (iconv_close(handler->iconv_in))
26842688
ret = -1;
2685-
handler->iconv_in = NULL;
2689+
handler->iconv_in = (iconv_t) -1;
26862690
}
26872691
}
26882692
#endif /* LIBXML_ICONV_ENABLED */

include/libxml/xmlexports.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#if defined(_WIN32) || defined(__CYGWIN__)
18-
#if defined(LIBXML_STATIC) || defined(_LIB)
18+
#ifdef LIBXML_STATIC
1919
#define XMLPUBLIC
2020
#elif defined(IN_LIBXML)
2121
#define XMLPUBLIC __declspec(dllexport)

0 commit comments

Comments
 (0)