mirror of
https://github.com/openbsd/src.git
synced 2026-06-18 15:23:33 +02:00
Update libexpat to version 2.8.0
Relevant for OpenBSD are other changes #1201 #1189 #1203 #1204 #1194 #1202 #1187 #1192 #1171 #1170. Minor library bump is necessary as XML_SetHashSalt16Bytes() has been added. Security fixes have been backported in previous commit. OK tb@
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
!! THANK YOU! Sebastian Pipping -- Berlin, 2026-03-17 !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
Release 2.8.0 Fri April 24 2026
|
||||
Security fixes:
|
||||
#47 #1183 CVE-2026-41080 -- The existing hash flooding protection
|
||||
(based on SipHash) only used 4 to 8 bytes of entropy for
|
||||
@@ -45,6 +46,55 @@
|
||||
internal machinery (by *not* calling either of the two
|
||||
XML_SetHashSalt* functions).
|
||||
|
||||
Bug fixes:
|
||||
#1188 Avoid propagating /dev/urandom file descriptor to child
|
||||
processes
|
||||
#1193 Fix interpretation of `errno` after randomization calls
|
||||
#1195 Avoid assuming uint8_t is a character type
|
||||
|
||||
Other changes:
|
||||
#1180 #1199 Add support for `getentropy(3)` as a source of entropy;
|
||||
this helps with protecting against hash flooding attacks,
|
||||
in particular with WASI SDK (where none of the other
|
||||
entropy sources supported by libexpat are available).
|
||||
#1200 Autotools: Add `--without-arc4random` and
|
||||
`--without-arc4random-buf`
|
||||
#1200 Autotools: Make `./configure` output report on available
|
||||
high quality entropy sources
|
||||
#1173 Autotools|macOS: Sync CMake templates with CMake 4.3.0
|
||||
#1201 Autotools|CMake: Improve checks for `arc4random` and
|
||||
`arc4random_buf` e.g. with modern glibc
|
||||
#1201 CMake: Report on availability of functions `arc4random` and
|
||||
`arc4random_buf`
|
||||
#1201 CMake: Mark entropy related build switches as advanced
|
||||
#1189 ..
|
||||
#1203 #1204 Extract new files from entropy extraction code
|
||||
#1194 Stop duplicating C tests 1:1 as C++ ("runtests_cxx")
|
||||
#1202 Fix a comment typo in expat_external.h
|
||||
#1187 Fix grammar in compile error message
|
||||
#1192 examples: Build warning-free with -Wwrite-strings
|
||||
#1171 tests: Address harmless warning from Coverity
|
||||
#1170 #1176 Sync file headers
|
||||
#1190 #1206 Version info bumped from 12:3:11 (libexpat*.so.1.11.3)
|
||||
to 13:0:12 (libexpat*.so.1.12.0); see https://verbump.de/
|
||||
for what these numbers do
|
||||
|
||||
Infrastructure:
|
||||
#1166 #1167 ..
|
||||
#1172 #1175 ..
|
||||
#1178 #1179 ..
|
||||
#1185 #1205 CI: Make Perl XML::Parser integration tests run against
|
||||
both version 2.47 and the latest release 2.58
|
||||
#1169 CI: Adapt to breaking changes regarding Inno Setup
|
||||
#1173 CI: Adapt to breaking changes regarding CMake
|
||||
#1174 CI: Include public corpus of fuzzer `xml_lpm_fuzzer` with
|
||||
regression testing
|
||||
#1181 #1182 CI: Bump WASI SDK from 30 to 32
|
||||
|
||||
Special thanks to:
|
||||
Jérôme Duval
|
||||
Matthew Fernandez
|
||||
|
||||
Release 2.7.5 Tue March 17 2026
|
||||
Security fixes:
|
||||
#1158 CVE-2026-32776 -- Fix NULL function pointer dereference for
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.17 2025/10/23 19:06:10 miod Exp $
|
||||
# $OpenBSD: Makefile,v 1.18 2026/05/11 22:41:23 bluhm Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/lib
|
||||
|
||||
LIB= expat
|
||||
SRCS= xmlparse.c xmltok.c xmlrole.c
|
||||
SRCS= xmlparse.c xmltok.c xmlrole.c random_arc4random_buf.c
|
||||
CFLAGS+=-I${.CURDIR} -fvisibility=hidden -DXML_ENABLE_VISIBILITY=1
|
||||
|
||||
PC_FILES=expat.pc
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
> at the top of the `Changes` file.
|
||||
|
||||
|
||||
# Expat, Release 2.7.5
|
||||
# Expat, Release 2.8.0
|
||||
|
||||
This is Expat, a C99 library for parsing
|
||||
[XML 1.0 Fourth Edition](https://www.w3.org/TR/2006/REC-xml-20060816/), started by
|
||||
@@ -297,10 +297,4 @@ EXPAT_SYMBOL_VERSIONING:BOOL=OFF
|
||||
|
||||
// Treat all compiler warnings as errors
|
||||
EXPAT_WARNINGS_AS_ERRORS:BOOL=OFF
|
||||
|
||||
// Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]
|
||||
EXPAT_WITH_GETRANDOM:STRING=AUTO
|
||||
|
||||
// Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]
|
||||
EXPAT_WITH_SYS_GETRANDOM:STRING=AUTO
|
||||
```
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<body>
|
||||
<div>
|
||||
<h1>
|
||||
The Expat XML Parser <small>Release 2.7.5</small>
|
||||
The Expat XML Parser <small>Release 2.8.0</small>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
@@ -404,7 +404,11 @@
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#XML_SetHashSalt">XML_SetHashSalt</a>
|
||||
<a href="#XML_SetHashSalt">XML_SetHashSalt</a> (deprecated)
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#XML_SetHashSalt16Bytes">XML_SetHashSalt16Bytes</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
@@ -3449,22 +3453,35 @@ XML_SetParamEntityParsing(XML_Parser p,
|
||||
</div>
|
||||
|
||||
<h4 id="XML_SetHashSalt">
|
||||
XML_SetHashSalt
|
||||
XML_SetHashSalt (deprecated)
|
||||
</h4>
|
||||
|
||||
<pre class="fcndec">
|
||||
int XMLCALL
|
||||
XML_SetHashSalt(XML_Parser p,
|
||||
XML_SetHashSalt(XML_Parser parser,
|
||||
unsigned long hash_salt);
|
||||
</pre>
|
||||
<div class="fcndef">
|
||||
Sets the hash salt to use for internal hash calculations. Helps in preventing DoS
|
||||
attacks based on predicting hash function behavior. In order to have an effect
|
||||
this must be called before parsing has started. Returns 1 if successful, 0 when
|
||||
called after <code>XML_Parse</code> or <code>XML_ParseBuffer</code>.
|
||||
called after <code>XML_Parse</code> or <code>XML_ParseBuffer</code> or when
|
||||
<code>parser</code> is <code>NULL</code>.
|
||||
<p>
|
||||
<b>Note:</b> Function <code>XML_SetHashSalt</code> is
|
||||
<strong>deprecated</strong>. Please use function <code><a href=
|
||||
"#XML_SetHashSalt16Bytes">XML_SetHashSalt16Bytes</a></code> instead for better
|
||||
security. <code>XML_SetHashSalt</code> only provides 4 to 8 bytes of entropy
|
||||
(depending on the size of type <code>unsigned long</code>) while the SipHash
|
||||
implementation used by Expat can leverage up to 16 bytes of entropy — at least
|
||||
twice as much. Function <code><a href=
|
||||
"#XML_SetHashSalt16Bytes">XML_SetHashSalt16Bytes</a></code> of Expat >=2.8.0
|
||||
(and where backported) matches the amount of entropy supported by SipHash.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Note:</b> This call is optional, as the parser will auto-generate a new
|
||||
random salt value if no value has been set at the start of parsing.
|
||||
random salt value internally if no value has been set by the start of parsing.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -3475,6 +3492,34 @@ XML_SetHashSalt(XML_Parser p,
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h4 id="XML_SetHashSalt16Bytes">
|
||||
XML_SetHashSalt16Bytes
|
||||
</h4>
|
||||
|
||||
<pre class="fcndec">
|
||||
/* Added in Expat 2.8.0. */
|
||||
XML_Bool XMLCALL
|
||||
XML_SetHashSalt16Bytes(XML_Parser parser,
|
||||
const uint8_t entropy[16]);
|
||||
</pre>
|
||||
<div class="fcndef">
|
||||
Sets the hash salt to use for internal hash calculations. Helps in preventing DoS
|
||||
attacks based on predicting hash function behavior. In order to have an effect
|
||||
this must be called before parsing has started. Returns <code>XML_TRUE</code> if
|
||||
successful, <code>XML_FALSE</code> when called after <code>XML_Parse</code> or
|
||||
<code>XML_ParseBuffer</code> or when <code>parser</code> is <code>NULL</code>.
|
||||
<p>
|
||||
<b>Note:</b> Setting a salt that is <em>not</em> from a source of high quality
|
||||
entropy (like <code>getentropy(3)</code>) will make the parser vulnerable to
|
||||
hash flooding attacks.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Note:</b> This call is optional, as the parser will auto-generate a new
|
||||
random salt value internally if no value has been set by the start of parsing.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h4 id="XML_UseForeignDTD">
|
||||
XML_UseForeignDTD
|
||||
</h4>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
|
||||
Copyright (c) 2019 Zhongyuan Zhou <zhouzhongyuan@huawei.com>
|
||||
Copyright (c) 2024 Hanno Böck <hanno@gentoo.org>
|
||||
Copyright (c) 2026 Matthew Fernandez <matthew.fernandez@gmail.com>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
@@ -82,7 +83,7 @@ stackPopFree(Stack *stackTop) {
|
||||
return newStackTop;
|
||||
}
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
contentTypeName(enum XML_Content_Type contentType) {
|
||||
switch (contentType) {
|
||||
case XML_CTYPE_EMPTY:
|
||||
@@ -102,7 +103,7 @@ contentTypeName(enum XML_Content_Type contentType) {
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
contentQuantName(enum XML_Content_Quant contentQuant) {
|
||||
switch (contentQuant) {
|
||||
case XML_CQUANT_NONE:
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/* $OpenBSD: expat_config.h,v 1.6 2024/02/11 00:56:28 bluhm Exp $ */
|
||||
/* $OpenBSD: expat_config.h,v 1.7 2026/05/11 22:41:23 bluhm Exp $ */
|
||||
|
||||
/* quick and dirty conf for OpenBSD */
|
||||
|
||||
#define HAVE_ARC4RANDOM 1
|
||||
#define HAVE_ARC4RANDOM_BUF 1
|
||||
#define XML_CONTEXT_BYTES 1024
|
||||
#define XML_DTD 1
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#ifndef Expat_INCLUDED
|
||||
# define Expat_INCLUDED 1
|
||||
|
||||
# include <stdint.h> // for uint8_t
|
||||
# include <stdlib.h>
|
||||
# include "expat_external.h"
|
||||
|
||||
@@ -917,10 +918,21 @@ XML_SetParamEntityParsing(XML_Parser parser,
|
||||
function behavior. This must be called before parsing is started.
|
||||
Returns 1 if successful, 0 when called after parsing has started.
|
||||
Note: If parser == NULL, the function will do nothing and return 0.
|
||||
DEPRECATED since Expat 2.8.0.
|
||||
*/
|
||||
XMLPARSEAPI(int)
|
||||
XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt);
|
||||
|
||||
/* Sets the hash salt to use for internal hash calculations.
|
||||
Helps in preventing DoS attacks based on predicting hash function behavior.
|
||||
This must be called before parsing is started.
|
||||
Returns XML_TRUE if successful, XML_FALSE when called after parsing has
|
||||
started or when parser is NULL.
|
||||
Added in Expat 2.8.0.
|
||||
*/
|
||||
XMLPARSEAPI(XML_Bool)
|
||||
XML_SetHashSalt16Bytes(XML_Parser parser, const uint8_t entropy[16]);
|
||||
|
||||
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
|
||||
XML_GetErrorCode returns information about the error.
|
||||
*/
|
||||
@@ -1081,8 +1093,8 @@ XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled);
|
||||
See https://semver.org
|
||||
*/
|
||||
# define XML_MAJOR_VERSION 2
|
||||
# define XML_MINOR_VERSION 7
|
||||
# define XML_MICRO_VERSION 5
|
||||
# define XML_MINOR_VERSION 8
|
||||
# define XML_MICRO_VERSION 0
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
|
||||
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
|
||||
Copyright (c) 2016 Cristian Rodríguez <crrodriguez@opensuse.org>
|
||||
Copyright (c) 2016-2026 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2016-2025 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
|
||||
Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com>
|
||||
Copyright (c) 2026 Matthew Fernandez <matthew.fernandez@gmail.com>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
@@ -45,7 +46,7 @@
|
||||
/* Expat tries very hard to make the API boundary very specifically
|
||||
defined. There are two macros defined to control this boundary;
|
||||
each of these can be defined before including this header to
|
||||
achieve some different behavior, but doing so it not recommended or
|
||||
achieve some different behavior, but doing so is not recommended or
|
||||
tested frequently.
|
||||
|
||||
XMLCALL - The calling convention to use for all calls across the
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
Copyright (c) 2002-2003 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
|
||||
Copyright (c) 2003 Greg Stein <gstein@users.sourceforge.net>
|
||||
Copyright (c) 2016-2025 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2016-2026 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com>
|
||||
Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
|
||||
Copyright (c) 2023-2024 Sony Corporation / Snild Dolkow <snild@sony.com>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
|
||||
This is used to ensure the Expat headers can be included from C++
|
||||
and have everything work as expected.
|
||||
/*
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
@@ -9,8 +6,7 @@
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2005 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||
Copyright (c) 2017-2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2026 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
@@ -33,4 +29,15 @@
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtests.c"
|
||||
#include "random_arc4random_buf.h"
|
||||
|
||||
#if ! defined(_DEFAULT_SOURCE)
|
||||
# define _DEFAULT_SOURCE 1 /* for glibc */
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> // for arc4random_buf
|
||||
|
||||
void
|
||||
writeRandomBytes_arc4random_buf(void *target, size_t count) {
|
||||
arc4random_buf(target, count);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
/*
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
@@ -6,7 +6,7 @@
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2026 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
@@ -29,4 +29,11 @@
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "acc_tests.c"
|
||||
#if ! defined(RANDOM_ACR4RANDOM_BUF_H)
|
||||
# define RANDOM_ACR4RANDOM_BUF_H 1
|
||||
|
||||
# include <stddef.h> // for size_t
|
||||
|
||||
void writeRandomBytes_arc4random_buf(void *target, size_t count);
|
||||
|
||||
#endif // ! defined(RANDOM_ACR4RANDOM_BUF_H)
|
||||
+63
-163
@@ -1,4 +1,4 @@
|
||||
/* 93c1caa66e2b0310459482516af05505b57c5cb7b96df777105308fc585c85d1 (2.7.5+)
|
||||
/* a5d18f6a50f536615ac1c70304f87d94f99cc85a86b502188952440610ccf0f8 (2.8.0+)
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
@@ -41,10 +41,12 @@
|
||||
Copyright (c) 2023-2024 Sony Corporation / Snild Dolkow <snild@sony.com>
|
||||
Copyright (c) 2024-2025 Berkay Eren Ürün <berkay.ueruen@siemens.com>
|
||||
Copyright (c) 2024 Hanno Böck <hanno@gentoo.org>
|
||||
Copyright (c) 2025 Matthew Fernandez <matthew.fernandez@gmail.com>
|
||||
Copyright (c) 2025-2026 Matthew Fernandez <matthew.fernandez@gmail.com>
|
||||
Copyright (c) 2025 Atrem Borovik <polzovatellllk@gmail.com>
|
||||
Copyright (c) 2025 Alfonso Gregory <gfunni234@gmail.com>
|
||||
Copyright (c) 2026 Rosen Penev <rosenp@gmail.com>
|
||||
Copyright (c) 2026 Francesco Bertolaccini
|
||||
Copyright (c) 2026 Christian Ng <christianrng@berkeley.edu>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
@@ -84,28 +86,16 @@
|
||||
# error XML_CONTEXT_BYTES must be defined, non-empty and >=0 (0 to disable, >=1 to enable; 1024 is a common default)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SYSCALL_GETRANDOM)
|
||||
# if ! defined(_GNU_SOURCE)
|
||||
# define _GNU_SOURCE 1 /* syscall prototype */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
/* force stdlib to define rand_s() */
|
||||
# if ! defined(_CRT_RAND_S)
|
||||
# define _CRT_RAND_S
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h> /* memset(), memcpy() */
|
||||
#include <assert.h>
|
||||
#include <limits.h> /* INT_MAX, UINT_MAX */
|
||||
#include <stdio.h> /* fprintf */
|
||||
#include <stdlib.h> /* getenv, rand_s */
|
||||
#include <stdlib.h> /* getenv */
|
||||
#include <stdint.h> /* SIZE_MAX, uintptr_t */
|
||||
#include <math.h> /* isnan */
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
# define getpid GetCurrentProcessId
|
||||
@@ -125,26 +115,34 @@
|
||||
#include "expat.h"
|
||||
#include "siphash.h"
|
||||
|
||||
#if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)
|
||||
# if defined(HAVE_GETRANDOM)
|
||||
# include <sys/random.h> /* getrandom */
|
||||
# else
|
||||
# include <unistd.h> /* syscall */
|
||||
# include <sys/syscall.h> /* SYS_getrandom */
|
||||
# endif
|
||||
# if ! defined(GRND_NONBLOCK)
|
||||
# define GRND_NONBLOCK 0x0001
|
||||
# endif /* defined(GRND_NONBLOCK) */
|
||||
#endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */
|
||||
#if defined(HAVE_ARC4RANDOM)
|
||||
# include "random_arc4random.h"
|
||||
#endif /* defined(HAVE_ARC4RANDOM) */
|
||||
|
||||
#if defined(_WIN32) && ! defined(LOAD_LIBRARY_SEARCH_SYSTEM32)
|
||||
# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
|
||||
#endif
|
||||
#if defined(HAVE_ARC4RANDOM_BUF)
|
||||
# include "random_arc4random_buf.h"
|
||||
#endif // defined(HAVE_ARC4RANDOM_BUF)
|
||||
|
||||
#if defined(XML_DEV_URANDOM)
|
||||
# include "random_dev_urandom.h"
|
||||
#endif /* defined(XML_DEV_URANDOM) */
|
||||
|
||||
#if defined(HAVE_GETENTROPY)
|
||||
# include "random_getentropy.h"
|
||||
#endif // defined(HAVE_GETENTROPY)
|
||||
|
||||
#if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)
|
||||
# include "random_getrandom.h"
|
||||
#endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include "random_rand_s.h"
|
||||
#endif /* defined(_WIN32) */
|
||||
|
||||
#if ! defined(HAVE_GETRANDOM) && ! defined(HAVE_SYSCALL_GETRANDOM) \
|
||||
&& ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) \
|
||||
&& ! defined(XML_DEV_URANDOM) && ! defined(_WIN32) \
|
||||
&& ! defined(XML_POOR_ENTROPY)
|
||||
&& ! defined(HAVE_GETENTROPY) && ! defined(XML_DEV_URANDOM) \
|
||||
&& ! defined(_WIN32) && ! defined(XML_POOR_ENTROPY)
|
||||
# error You do not have support for any sources of high quality entropy \
|
||||
enabled. For end user security, that is probably not what you want. \
|
||||
\
|
||||
@@ -153,10 +151,11 @@
|
||||
* Linux >=3.17 + glibc (including <2.25) (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \
|
||||
* BSD / macOS >=10.7 / glibc >=2.36 (arc4random_buf): HAVE_ARC4RANDOM_BUF, \
|
||||
* BSD / macOS (including <10.7) / glibc >=2.36 (arc4random): HAVE_ARC4RANDOM, \
|
||||
* BSD / macOS >=10.12 / glibc >=2.25 (getentropy): HAVE_GETENTROPY, \
|
||||
* Linux (including <3.17) / BSD / macOS (including <10.7) / Solaris >=8 (/dev/urandom): XML_DEV_URANDOM, \
|
||||
* Windows >=Vista (rand_s): _WIN32. \
|
||||
\
|
||||
If insist on not using any of these, bypass this error by defining \
|
||||
If you insist on not using any of these, bypass this error by defining \
|
||||
XML_POOR_ENTROPY; you have been warned. \
|
||||
\
|
||||
If you have reasons to patch this detection code away or need changes \
|
||||
@@ -1037,135 +1036,6 @@ static const XML_Char implicitContext[]
|
||||
ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e,
|
||||
'\0'};
|
||||
|
||||
/* To avoid warnings about unused functions: */
|
||||
#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
|
||||
|
||||
# if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)
|
||||
|
||||
/* Obtain entropy on Linux 3.17+ */
|
||||
static int
|
||||
writeRandomBytes_getrandom_nonblock(void *target, size_t count) {
|
||||
int success = 0; /* full count bytes written? */
|
||||
size_t bytesWrittenTotal = 0;
|
||||
const unsigned int getrandomFlags = GRND_NONBLOCK;
|
||||
|
||||
do {
|
||||
void *const currentTarget = (void *)((char *)target + bytesWrittenTotal);
|
||||
const size_t bytesToWrite = count - bytesWrittenTotal;
|
||||
|
||||
assert(bytesToWrite <= INT_MAX);
|
||||
|
||||
const int bytesWrittenMore =
|
||||
# if defined(HAVE_GETRANDOM)
|
||||
(int)getrandom(currentTarget, bytesToWrite, getrandomFlags);
|
||||
# else
|
||||
(int)syscall(SYS_getrandom, currentTarget, bytesToWrite,
|
||||
getrandomFlags);
|
||||
# endif
|
||||
|
||||
if (bytesWrittenMore > 0) {
|
||||
bytesWrittenTotal += bytesWrittenMore;
|
||||
if (bytesWrittenTotal >= count)
|
||||
success = 1;
|
||||
}
|
||||
} while (! success && (errno == EINTR));
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
# endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */
|
||||
|
||||
# if ! defined(_WIN32) && defined(XML_DEV_URANDOM)
|
||||
|
||||
/* Extract entropy from /dev/urandom */
|
||||
static int
|
||||
writeRandomBytes_dev_urandom(void *target, size_t count) {
|
||||
int success = 0; /* full count bytes written? */
|
||||
size_t bytesWrittenTotal = 0;
|
||||
|
||||
const int fd = open("/dev/urandom", O_RDONLY);
|
||||
if (fd < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
do {
|
||||
void *const currentTarget = (void *)((char *)target + bytesWrittenTotal);
|
||||
const size_t bytesToWrite = count - bytesWrittenTotal;
|
||||
|
||||
const ssize_t bytesWrittenMore = read(fd, currentTarget, bytesToWrite);
|
||||
|
||||
if (bytesWrittenMore > 0) {
|
||||
bytesWrittenTotal += bytesWrittenMore;
|
||||
if (bytesWrittenTotal >= count)
|
||||
success = 1;
|
||||
}
|
||||
} while (! success && (errno == EINTR));
|
||||
|
||||
close(fd);
|
||||
return success;
|
||||
}
|
||||
|
||||
# endif /* ! defined(_WIN32) && defined(XML_DEV_URANDOM) */
|
||||
|
||||
#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */
|
||||
|
||||
#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF)
|
||||
|
||||
static void
|
||||
writeRandomBytes_arc4random(void *target, size_t count) {
|
||||
size_t bytesWrittenTotal = 0;
|
||||
|
||||
while (bytesWrittenTotal < count) {
|
||||
const uint32_t random32 = arc4random();
|
||||
size_t i = 0;
|
||||
|
||||
for (; (i < sizeof(random32)) && (bytesWrittenTotal < count);
|
||||
i++, bytesWrittenTotal++) {
|
||||
const uint8_t random8 = (uint8_t)(random32 >> (i * 8));
|
||||
((uint8_t *)target)[bytesWrittenTotal] = random8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF) */
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
/* Provide declaration of rand_s() for MinGW-32 (not 64, which has it),
|
||||
as it didn't declare it in its header prior to version 5.3.0 of its
|
||||
runtime package (mingwrt, containing stdlib.h). The upstream fix
|
||||
was introduced at https://osdn.net/projects/mingw/ticket/39658 . */
|
||||
# if defined(__MINGW32__) && defined(__MINGW32_VERSION) \
|
||||
&& __MINGW32_VERSION < 5003000L && ! defined(__MINGW64_VERSION_MAJOR)
|
||||
__declspec(dllimport) int rand_s(unsigned int *);
|
||||
# endif
|
||||
|
||||
/* Obtain entropy on Windows using the rand_s() function which
|
||||
* generates cryptographically secure random numbers. Internally it
|
||||
* uses RtlGenRandom API which is present in Windows XP and later.
|
||||
*/
|
||||
static int
|
||||
writeRandomBytes_rand_s(void *target, size_t count) {
|
||||
size_t bytesWrittenTotal = 0;
|
||||
|
||||
while (bytesWrittenTotal < count) {
|
||||
unsigned int random32 = 0;
|
||||
size_t i = 0;
|
||||
|
||||
if (rand_s(&random32))
|
||||
return 0; /* failure */
|
||||
|
||||
for (; (i < sizeof(random32)) && (bytesWrittenTotal < count);
|
||||
i++, bytesWrittenTotal++) {
|
||||
const uint8_t random8 = (uint8_t)(random32 >> (i * 8));
|
||||
((uint8_t *)target)[bytesWrittenTotal] = random8;
|
||||
}
|
||||
}
|
||||
return 1; /* success */
|
||||
}
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
|
||||
|
||||
static unsigned long
|
||||
@@ -1211,7 +1081,7 @@ generate_hash_secret_salt(void) {
|
||||
|
||||
/* "Failproof" high quality providers: */
|
||||
#if defined(HAVE_ARC4RANDOM_BUF)
|
||||
arc4random_buf(&entropy, sizeof(entropy));
|
||||
writeRandomBytes_arc4random_buf(&entropy, sizeof(entropy));
|
||||
return ENTROPY_DEBUG("arc4random_buf", entropy);
|
||||
#elif defined(HAVE_ARC4RANDOM)
|
||||
writeRandomBytes_arc4random(&entropy, sizeof(entropy));
|
||||
@@ -1222,6 +1092,11 @@ generate_hash_secret_salt(void) {
|
||||
if (writeRandomBytes_rand_s(&entropy, sizeof(entropy))) {
|
||||
return ENTROPY_DEBUG("rand_s", entropy);
|
||||
}
|
||||
# elif defined(HAVE_GETENTROPY)
|
||||
if (writeRandomBytes_getentropy(&entropy, sizeof(entropy))) {
|
||||
return ENTROPY_DEBUG("getentropy", entropy);
|
||||
}
|
||||
errno = 0;
|
||||
# elif defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)
|
||||
if (writeRandomBytes_getrandom_nonblock(&entropy, sizeof(entropy))) {
|
||||
return ENTROPY_DEBUG("getrandom", entropy);
|
||||
@@ -2328,6 +2203,7 @@ XML_SetParamEntityParsing(XML_Parser parser,
|
||||
#endif
|
||||
}
|
||||
|
||||
// DEPRECATED since Expat 2.8.0.
|
||||
int XMLCALL
|
||||
XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) {
|
||||
if (parser == NULL)
|
||||
@@ -2355,6 +2231,30 @@ XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
XML_Bool XMLCALL
|
||||
XML_SetHashSalt16Bytes(XML_Parser parser, const uint8_t entropy[16]) {
|
||||
if (parser == NULL)
|
||||
return XML_FALSE;
|
||||
|
||||
if (entropy == NULL)
|
||||
return XML_FALSE;
|
||||
|
||||
const XML_Parser rootParser = getRootParserOf(parser, NULL);
|
||||
assert(! rootParser->m_parentParser);
|
||||
|
||||
/* block after XML_Parse()/XML_ParseBuffer() has been called */
|
||||
if (parserBusy(rootParser))
|
||||
return XML_FALSE;
|
||||
|
||||
sip_tokey(&(rootParser->m_hash_secret_salt_128), entropy);
|
||||
|
||||
rootParser->m_hash_secret_salt_set = XML_TRUE;
|
||||
|
||||
ENTROPY_DEBUG("explicit(16)", rootParser->m_hash_secret_salt_128);
|
||||
|
||||
return XML_TRUE;
|
||||
}
|
||||
|
||||
enum XML_Status XMLCALL
|
||||
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) {
|
||||
if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
|
||||
Copyright (c) 2002-2003 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||
Copyright (c) 2005-2009 Steven Solie <steven@solie.ca>
|
||||
Copyright (c) 2016-2026 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2016-2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
|
||||
Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
|
||||
Copyright (c) 2021 Donghee Na <donghee.na@python.org>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
|
||||
Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
|
||||
Copyright (c) 2005-2009 Steven Solie <steven@solie.ca>
|
||||
Copyright (c) 2016-2026 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2016-2024 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2016 Pascal Cuoq <cuoq@trust-in-soft.com>
|
||||
Copyright (c) 2016 Don Lewis <truckman@apache.org>
|
||||
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
|
||||
Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
|
||||
Copyright (c) 2017-2026 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2025 Alfonso Gregory <gfunni234@gmail.com>
|
||||
Licensed under the MIT license:
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
major=17
|
||||
minor=0
|
||||
minor=1
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "alloc_tests.c"
|
||||
@@ -20,6 +20,7 @@
|
||||
Copyright (c) 2021 Donghee Na <donghee.na@python.org>
|
||||
Copyright (c) 2023-2024 Sony Corporation / Snild Dolkow <snild@sony.com>
|
||||
Copyright (c) 2024-2025 Berkay Eren Ürün <berkay.ueruen@siemens.com>
|
||||
Copyright (c) 2026 Francesco Bertolaccini
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
@@ -204,6 +205,30 @@ START_TEST(test_hash_collision) {
|
||||
END_TEST
|
||||
#undef COLLIDING_HASH_SALT
|
||||
|
||||
START_TEST(test_hash_salt_setter) {
|
||||
const uint8_t entropy[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
|
||||
// NULL parser should be rejected
|
||||
assert_true(XML_SetHashSalt16Bytes(NULL, entropy) == XML_FALSE);
|
||||
|
||||
// NULL entropy should be rejected
|
||||
assert_true(XML_SetHashSalt16Bytes(parser, NULL) == XML_FALSE);
|
||||
|
||||
// Setting should be allowed more than once
|
||||
assert_true(XML_SetHashSalt16Bytes(parser, entropy) == XML_TRUE);
|
||||
assert_true(XML_SetHashSalt16Bytes(parser, entropy) == XML_TRUE);
|
||||
|
||||
// But not after parsing has started
|
||||
assert_true(XML_Parse(parser, "", 0, XML_FALSE /* isFinal */)
|
||||
== XML_STATUS_OK);
|
||||
assert_true(XML_SetHashSalt16Bytes(parser, entropy) == XML_FALSE);
|
||||
|
||||
XML_ParserFree(parser);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
/* Regression test for SF bug #491986. */
|
||||
START_TEST(test_danish_latin1) {
|
||||
const char *text = "<?xml version='1.0' encoding='iso-8859-1'?>\n"
|
||||
@@ -6296,6 +6321,7 @@ make_basic_test_case(Suite *s) {
|
||||
tcase_add_test(tc_basic, test_bom_utf16_le);
|
||||
tcase_add_test(tc_basic, test_nobom_utf16_le);
|
||||
tcase_add_test(tc_basic, test_hash_collision);
|
||||
tcase_add_test(tc_basic, test_hash_salt_setter);
|
||||
tcase_add_test(tc_basic, test_illegal_utf8);
|
||||
tcase_add_test(tc_basic, test_utf8_auto_align);
|
||||
tcase_add_test(tc_basic, test_utf16);
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "basic_tests.c"
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "chardata.c"
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "common.c"
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "dummy.c"
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "handlers.c"
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "memcheck.c"
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "minicheck.c"
|
||||
@@ -212,7 +212,7 @@ START_TEST(test_misc_version) {
|
||||
if (! versions_equal(&read_version, &parsed_version))
|
||||
fail("Version mismatch");
|
||||
|
||||
if (xcstrcmp(version_text, XCS("expat_2.7.5"))
|
||||
if (xcstrcmp(version_text, XCS("expat_2.8.0"))
|
||||
!= 0) /* needs bump on releases */
|
||||
fail("XML_*_VERSION in expat.h out of sync?\n");
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "misc_tests.c"
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ns_tests.c"
|
||||
@@ -10,7 +10,7 @@
|
||||
Copyright (c) 2003 Greg Stein <gstein@users.sourceforge.net>
|
||||
Copyright (c) 2005-2007 Steven Solie <steven@solie.ca>
|
||||
Copyright (c) 2005-2012 Karl Waclawek <karl@waclawek.net>
|
||||
Copyright (c) 2016-2025 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2016-2026 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2017-2022 Rhodri James <rhodri@wildebeest.org.uk>
|
||||
Copyright (c) 2017 Joe Orton <jorton@redhat.com>
|
||||
Copyright (c) 2017 José Gutiérrez de la Concha <jose@zeroc.com>
|
||||
@@ -18,6 +18,7 @@
|
||||
Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
|
||||
Copyright (c) 2020 Tim Gates <tim.gates@iress.com>
|
||||
Copyright (c) 2021 Donghee Na <donghee.na@python.org>
|
||||
Copyright (c) 2026 Christian Ng <christianrng@berkeley.edu>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
@@ -1507,7 +1508,7 @@ END_TEST
|
||||
|
||||
/* Verify that retry after OOM in setContext() does not crash.
|
||||
*/
|
||||
START_TEST(test_nsalloc_setContext_zombie) {
|
||||
START_TEST(test_nsalloc_set_context_zombie) {
|
||||
const char *text = "<doc>Hello</doc>";
|
||||
unsigned int i;
|
||||
const unsigned int max_alloc_count = 30;
|
||||
@@ -1519,7 +1520,9 @@ START_TEST(test_nsalloc_setContext_zombie) {
|
||||
break;
|
||||
/* Retry on the same parser — must not crash */
|
||||
g_allocation_count = ALLOC_ALWAYS_SUCCEED;
|
||||
XML_Parse(g_parser, text, (int)strlen(text), XML_TRUE);
|
||||
const enum XML_Status status
|
||||
= XML_Parse(g_parser, text, (int)strlen(text), XML_TRUE);
|
||||
(void)status;
|
||||
|
||||
nsalloc_teardown();
|
||||
nsalloc_setup();
|
||||
@@ -1565,5 +1568,5 @@ make_nsalloc_test_case(Suite *s) {
|
||||
tcase_add_test__if_xml_ge(tc_nsalloc, test_nsalloc_long_default_in_ext);
|
||||
tcase_add_test(tc_nsalloc, test_nsalloc_long_systemid_in_ext);
|
||||
tcase_add_test(tc_nsalloc, test_nsalloc_prefixed_element);
|
||||
tcase_add_test(tc_nsalloc, test_nsalloc_setContext_zombie);
|
||||
tcase_add_test(tc_nsalloc, test_nsalloc_set_context_zombie);
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "nsalloc_tests.c"
|
||||
@@ -1,32 +0,0 @@
|
||||
/* C++ compilation harness for the test suite.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "structdata.c"
|
||||
Reference in New Issue
Block a user