https://github.com/libexpat/libexpat/labels/help%20wanted
If you can help, please get in touch. Thanks!
+Release 2.3.0 Thu March 25 2021
+ Bug fixes:
+ #438 When calling XML_ParseBuffer without a prior successful call to
+ XML_GetBuffer as a user, no longer trigger undefined behavior
+ (by adding an integer to a NULL pointer) but rather return
+ XML_STATUS_ERROR and set the error code to (new) code
+ XML_ERROR_NO_BUFFER. Found by UBSan (UndefinedBehaviorSanitizer)
+ of Clang 11 (but not Clang 9).
+ #444 xmlwf: Exit status 2 was used for both:
+ - malformed input files (documented) and
+ - invalid command-line arguments (undocumented).
+ The case of invalid command-line arguments now
+ has its own exit status 4, resolving the ambiguity.
+
+ Other changes:
+ #439 xmlwf: Add argument -k to allow continuing after
+ non-fatal errors
+ #439 xmlwf: Add section about exit status to the -h help output
+ #422 #426 #447 Windows: Drop support for Visual Studio <=14.0/2015
+ #434 Windows: CMake: Detect unsupported Visual Studio at
+ configure time (rather than at compile time)
+ #382 #428 testrunner: Make verbose mode (argument "-v") report
+ about passed tests, and make default mode report about
+ failures, as well.
+ #442 CMake: Call "enable_language(CXX)" prior to tinkering
+ with CMAKE_CXX_* variables
+ #448 Document use of libexpat from a CMake-based project
+ #451 Autotools: Install CMake files as generated by CMake 3.19.6
+ so that users with "find_package(expat [..] CONFIG [..])"
+ are served on distributions that are *not* using the CMake
+ build system inside for libexpat packaging
+ #436 #437 Autotools: Drop obsolescent macro AC_HEADER_STDC
+ #450 #452 Autotools: Resolve use of obsolete macro AC_CONFIG_HEADER
+ #441 Address compiler warnings
+ #443 Version info bumped from 7:12:6 to 8:0:7
+ due to addition of error code XML_ERROR_NO_BUFFER
+ (see https://verbump.de/ for what these numbers do)
+
+ Infrastructure:
+ #435 #446 Replace Travis CI by GitHub Actions
+
+ Special thanks to:
+ Alexander Richardson
+ Oleksandr Popovych
+ Thomas Beutlich
+ Tim Bray
+ and
+ Clang LeakSan, Clang 11 UBSan and the Clang team
+
Release 2.2.10 Sat October 3 2020
Bug fixes:
#390 #395 #398 Fix undefined behavior during parsing caused by
#354 #355 ..
#356 #412 Address compiler warnings
#368 #369 Address pngcheck warnings with doc/*.png images
- Version info bumped from 7:11:6 to 7:12:6
+ #425 Version info bumped from 7:11:6 to 7:12:6
Special thanks to:
asavah
-[![Travis CI Build Status](https://travis-ci.org/libexpat/libexpat.svg?branch=master)](https://travis-ci.org/libexpat/libexpat)
+[![Run Linux Travis CI tasks](https://github.com/libexpat/libexpat/actions/workflows/linux.yml/badge.svg)](https://github.com/libexpat/libexpat/actions/workflows/linux.yml)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/libexpat/libexpat?svg=true)](https://ci.appveyor.com/project/libexpat/libexpat)
[![Packaging status](https://repology.org/badge/tiny-repos/expat.svg)](https://repology.org/metapackage/expat/versions)
-# Expat, Release 2.2.10
+# Expat, Release 2.3.0
This is Expat, a C library for parsing XML, started by
[James Clark](https://en.wikipedia.org/wiki/James_Clark_(programmer)) in 1997.
structures for which you may register handlers.
Expat supports the following compilers:
+
- GNU GCC >=4.5
- LLVM Clang >=3.5
-- Microsoft Visual Studio >=9.0/2008
+- Microsoft Visual Studio >=15.0/2017 (rolling `${today} minus 5 years`)
Windows users can use the
-[`expat_win32` package](https://sourceforge.net/projects/expat/files/expat_win32/),
-which includes both precompiled libraries and executables, and source code for
+[`expat-win32bin-*.*.*.exe` installer download](https://github.com/libexpat/libexpat/releases),
+which includes both pre-compiled libraries and executables, and source code for
developers.
Expat is [free software](https://www.gnu.org/philosophy/free-sw.en.html).
distributed with this package.
This license is the same as the MIT/X Consortium license.
+
+## Using libexpat in your CMake-Based Project
+
+There are two ways of using libexpat with CMake:
+
+### a) Module Mode
+
+This approach leverages CMake's own [module `FindEXPAT`](https://cmake.org/cmake/help/latest/module/FindEXPAT.html).
+
+Notice the uppercase `EXPAT` in the following example:
+
+```cmake
+cmake_minimum_required(VERSION 3.0)
+
+project(hello VERSION 1.0.0)
+
+find_package(EXPAT 2.2.8 MODULE REQUIRED)
+
+add_executable(hello
+ hello.c
+)
+
+if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.10")
+ target_link_libraries(hello PUBLIC EXPAT::EXPAT)
+else()
+ target_include_directories(hello PRIVATE ${EXPAT_INCLUDE_DIRS})
+ target_link_libraries(hello PUBLIC ${EXPAT_LIBRARIES})
+endif()
+```
+
+### b) Config Mode
+
+This approach requires files from
+libexpat >=2.2.8 where packaging uses the CMake build system
+or
+libexpat >=2.3.0 where packaging uses the GNU Autotools build system.
+
+Notice the lowercase `expat` in the following example:
+
+```cmake
+cmake_minimum_required(VERSION 3.0)
+
+project(hello VERSION 1.0.0)
+
+find_package(expat 2.2.8 CONFIG REQUIRED char dtd ns)
+
+add_executable(hello
+ hello.c
+)
+
+target_link_libraries(hello PUBLIC expat::expat)
+```
+
+
+## Buildung from a Git Clone
+
If you are building Expat from a check-out from the
[Git repository](https://github.com/libexpat/libexpat/),
you need to run a script that generates the configure script using the
Once this has been done, follow the same instructions as for building
from a source distribution.
+
+## Buildung from a Source Distribution
+
+### a) Building with the configure script (i.e. GNU Autotools)
+
To build Expat from a source distribution, you first run the
configuration shell script in the top level distribution directory:
distribution.
-The CMake build system is still *experimental* and will replace the primary
+### b) Building with CMake
+
+The CMake build system is still *experimental* and may replace the primary
build system based on GNU Autotools at some point when it is ready.
+
+
+#### Available Options
+
For an idea of the available (non-advanced) options for building with CMake:
```console
XML_ERROR_RESERVED_PREFIX_XMLNS,
XML_ERROR_RESERVED_NAMESPACE_URI,
/* Added in 2.2.1. */
- XML_ERROR_INVALID_ARGUMENT
+ XML_ERROR_INVALID_ARGUMENT,
+ /* Added in 2.3.0. */
+ XML_ERROR_NO_BUFFER
};
enum XML_Content_Type {
Otherwise it must return XML_STATUS_ERROR.
If info does not describe a suitable encoding, then the parser will
- return an XML_UNKNOWN_ENCODING error.
+ return an XML_ERROR_UNKNOWN_ENCODING error.
*/
typedef int(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
const XML_Char *name,
See http://semver.org.
*/
#define XML_MAJOR_VERSION 2
-#define XML_MINOR_VERSION 2
-#define XML_MICRO_VERSION 10
+#define XML_MINOR_VERSION 3
+#define XML_MICRO_VERSION 0
#ifdef __cplusplus
}
* --------------------------------------------------------------------------
* HISTORY:
*
+ * 2020-10-03 (Sebastian Pipping)
+ * - Drop support for Visual Studio 9.0/2008 and earlier
+ *
* 2019-08-03 (Sebastian Pipping)
* - Mark part of sip24_valid as to be excluded from clang-format
* - Re-format code using clang-format 9
#define SIPHASH_H
#include <stddef.h> /* size_t */
-
-#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1600)
-/* For vs2003/7.1 up to vs2008/9.0; _MSC_VER 1600 is vs2010/10.0 */
-typedef unsigned __int8 uint8_t;
-typedef unsigned __int32 uint32_t;
-typedef unsigned __int64 uint64_t;
-#else
-# include <stdint.h> /* uint64_t uint32_t uint8_t */
-#endif
+#include <stdint.h> /* uint64_t uint32_t uint8_t */
/*
* Workaround to not require a C++11 compiler for using ULL suffix
-/* 5cd169f2942b85c05e0b1b96f9990f91ac3d07e470ad7ce906ac8590c8ed4f35 (2.2.10+)
+/* d667b5f8e56e24fdfaf5e38596d419d924a9fadceb987d81d5613ecb7ca51b0e (2.3.0+)
__ __ _
___\ \/ /_ __ __ _| |_
/ _ \\ /| '_ \ / _` | __|
#include <limits.h> /* UINT_MAX */
#include <stdio.h> /* fprintf */
#include <stdlib.h> /* getenv, rand_s */
-
-#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1600)
-/* vs2008/9.0 and earlier lack stdint.h; _MSC_VER 1600 is vs2010/10.0 */
-# if defined(_WIN64)
-typedef unsigned __int64 uintptr_t;
-# else
-typedef unsigned __int32 uintptr_t;
-# endif
-#else
-# include <stdint.h> /* uintptr_t */
-#endif
+#include <stdint.h> /* uintptr_t */
#ifdef _WIN32
# define getpid GetCurrentProcessId
parser->m_errorCode = XML_ERROR_FINISHED;
return XML_STATUS_ERROR;
case XML_INITIALIZED:
+ /* Has someone called XML_GetBuffer successfully before? */
+ if (! parser->m_bufferPtr) {
+ parser->m_errorCode = XML_ERROR_NO_BUFFER;
+ return XML_STATUS_ERROR;
+ }
+
if (parser->m_parentParser == NULL && ! startParsing(parser)) {
parser->m_errorCode = XML_ERROR_NO_MEMORY;
return XML_STATUS_ERROR;
/* Added in 2.2.5. */
case XML_ERROR_INVALID_ARGUMENT: /* Constant added in 2.2.1, already */
return XML_L("invalid argument");
+ /* Added in 2.3.0. */
+ case XML_ERROR_NO_BUFFER:
+ return XML_L(
+ "a successful prior call to function XML_GetBuffer is required");
}
return NULL;
}
#include <stddef.h>
#include <string.h> /* memcpy */
-
-#if defined(_MSC_VER) && (_MSC_VER <= 1700)
-/* for vs2012/11.0/1700 and earlier Visual Studio compilers */
-# define bool int
-# define false 0
-# define true 1
-#else
-# include <stdbool.h>
-#endif
+#include <stdbool.h>
#ifdef _WIN32
# include "winconfig.h"
-major=12
+major=13
minor=0
}
static void
-add_failure(SRunner *runner, int verbosity) {
- runner->nfailures++;
+handle_success(int verbosity) {
if (verbosity >= CK_VERBOSE) {
- printf("%s:%d: %s\n", _check_current_filename, _check_current_lineno,
- _check_current_function);
+ printf("PASS: %s\n", _check_current_function);
+ }
+}
+
+static void
+handle_failure(SRunner *runner, int verbosity, const char *phase_info) {
+ runner->nfailures++;
+ if (verbosity != CK_SILENT) {
+ printf("FAIL: %s (%s at %s:%d)\n", _check_current_function, phase_info,
+ _check_current_filename, _check_current_lineno);
}
}
if (tc->setup != NULL) {
/* setup */
if (setjmp(env)) {
- add_failure(runner, verbosity);
+ handle_failure(runner, verbosity, "during setup");
continue;
}
tc->setup();
}
/* test */
if (setjmp(env)) {
- add_failure(runner, verbosity);
+ handle_failure(runner, verbosity, "during actual test");
continue;
}
(tc->tests[i])();
/* teardown */
if (tc->teardown != NULL) {
if (setjmp(env)) {
- add_failure(runner, verbosity);
+ handle_failure(runner, verbosity, "during teardown");
continue;
}
tc->teardown();
}
+
+ handle_success(verbosity);
}
tc = tc->next_tcase;
}
- if (verbosity) {
+ if (verbosity != CK_SILENT) {
int passed = runner->nchecks - runner->nfailures;
double percentage = ((double)passed) / runner->nchecks;
int display = (int)(percentage * 100);
it is.
*/
UNUSED_P(condition);
- UNUSED_P(file);
- UNUSED_P(line);
+ _check_current_filename = file;
+ _check_current_lineno = line;
if (msg != NULL) {
const int has_newline = (msg[strlen(msg) - 1] == '\n');
fprintf(stderr, "ERROR: %s%s", msg, has_newline ? "" : "\n");
#include <stddef.h> /* ptrdiff_t */
#include <ctype.h>
#include <limits.h>
-
-#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1600)
-/* For vs2003/7.1 up to vs2008/9.0; _MSC_VER 1600 is vs2010/10.0 */
-# if defined(_WIN64)
-typedef __int64 intptr_t;
-# else
-typedef __int32 intptr_t;
-# endif
-typedef unsigned __int64 uint64_t;
-#else
-# include <stdint.h> /* intptr_t uint64_t */
-#endif
+#include <stdint.h> /* intptr_t uint64_t */
#if ! defined(__cplusplus)
-# if defined(_MSC_VER) && (_MSC_VER <= 1700)
-/* for vs2012/11.0/1700 and earlier Visual Studio compilers */
-# define bool int
-# define false 0
-# define true 1
-# else
-# include <stdbool.h>
-# endif
+# include <stdbool.h>
#endif
#include "expat.h"
XML_SetNotStandaloneHandler(g_parser, accept_not_standalone_handler);
run_ext_character_check(text, &test_data, XCS(""));
- /* Repeat wtihout the external entity handler */
+ /* Repeat without the external entity handler */
XML_ParserReset(g_parser, NULL);
XML_SetNotStandaloneHandler(g_parser, accept_not_standalone_handler);
run_character_check(text, XCS(""));
fail("Version mismatch");
#if ! defined(XML_UNICODE) || defined(XML_UNICODE_WCHAR_T)
- if (xcstrcmp(version_text, XCS("expat_2.2.10"))) /* needs bump on releases */
+ if (xcstrcmp(version_text, XCS("expat_2.3.0"))) /* needs bump on releases */
fail("XML_*_VERSION in expat.h out of sync?\n");
#else
/* If we have XML_UNICODE defined but not XML_UNICODE_WCHAR_T
/* Try a parse before the start of the world */
/* (Exercises new code path) */
+ if (XML_ParseBuffer(g_parser, 0, XML_FALSE) != XML_STATUS_ERROR)
+ fail("Pre-init XML_ParseBuffer not faulted");
+ if (XML_GetErrorCode(g_parser) != XML_ERROR_NO_BUFFER)
+ fail("Pre-init XML_ParseBuffer faulted for wrong reason");
+
+ buffer = XML_GetBuffer(g_parser, 1 /* any small number greater than 0 */);
+ if (buffer == NULL)
+ fail("Could not acquire parse buffer");
+
allocation_count = 0;
if (XML_ParseBuffer(g_parser, 0, XML_FALSE) != XML_STATUS_ERROR)
fail("Pre-init XML_ParseBuffer not faulted");