diff options
author | 2025-03-12 17:23:33 +1100 | |
---|---|---|
committer | 2025-03-12 17:23:33 +1100 | |
commit | 288839a39514c5fa8d105655fa7c11bd6ca0de03 (patch) | |
tree | 63cddc1c8579091287a2821c24e2f0ab8ef3c874 /3rdparty/expat/xmlwf | |
parent | d69383bfb699daace0b565aa0ecdecdf39a119d1 (diff) |
3rdparty/expat: Updated to expat 2.6.4.
Diffstat (limited to '3rdparty/expat/xmlwf')
-rw-r--r-- | 3rdparty/expat/xmlwf/Makefile.am | 4 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/Makefile.in | 41 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/codepage.c | 6 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/codepage.h | 4 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/ct.c | 3 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/filemap.h | 4 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/readfilemap.c | 28 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/unixfilemap.c | 6 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/win32filemap.c | 7 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/xmlfile.c | 29 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/xmlfile.h | 7 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/xmlmime.c | 4 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/xmlmime.h | 3 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/xmltchar.h | 7 | ||||
-rw-r--r-- | 3rdparty/expat/xmlwf/xmlwf.c | 293 | ||||
-rwxr-xr-x | 3rdparty/expat/xmlwf/xmlwf_helpgen.py | 41 | ||||
-rwxr-xr-x | 3rdparty/expat/xmlwf/xmlwf_helpgen.sh | 5 |
17 files changed, 381 insertions, 111 deletions
diff --git a/3rdparty/expat/xmlwf/Makefile.am b/3rdparty/expat/xmlwf/Makefile.am index f35ade7a77a..c7eebd1eeec 100644 --- a/3rdparty/expat/xmlwf/Makefile.am +++ b/3rdparty/expat/xmlwf/Makefile.am @@ -6,7 +6,7 @@ # \___/_/\_\ .__/ \__,_|\__| # |_| XML parser # -# Copyright (c) 2017 Expat development team +# Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org> # Licensed under the MIT license: # # Permission is hereby granted, free of charge, to any person obtaining @@ -38,7 +38,7 @@ xmlwf_SOURCES = \ @FILEMAP@.c xmlwf_CPPFLAGS = @AM_CPPFLAGS@ -I$(srcdir)/../lib -xmlwf_LDFLAGS = @AM_LDFLAGS@ +xmlwf_LDFLAGS = @AM_LDFLAGS@ @LIBM@ if MINGW if UNICODE diff --git a/3rdparty/expat/xmlwf/Makefile.in b/3rdparty/expat/xmlwf/Makefile.in index 531475ab243..480fd3e0410 100644 --- a/3rdparty/expat/xmlwf/Makefile.in +++ b/3rdparty/expat/xmlwf/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -22,7 +22,7 @@ # \___/_/\_\ .__/ \__,_|\__| # |_| XML parser # -# Copyright (c) 2017 Expat development team +# Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org> # Licensed under the MIT license: # # Permission is hereby granted, free of charge, to any person obtaining @@ -134,6 +134,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/conftools/ax-append-compile-flags.m4 \ $(top_srcdir)/conftools/ax-append-link-flags.m4 \ $(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \ + $(top_srcdir)/conftools/ax-cxx-compile-stdcxx.m4 \ + $(top_srcdir)/conftools/ax-cxx-compile-stdcxx-11.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -216,8 +218,6 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in \ $(top_srcdir)/conftools/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -237,8 +237,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ +CMAKE_SHARED_LIBRARY_PREFIX = @CMAKE_SHARED_LIBRARY_PREFIX@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -254,10 +256,20 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ +EXPAT_ATTR_INFO = @EXPAT_ATTR_INFO@ +EXPAT_CHAR_TYPE = @EXPAT_CHAR_TYPE@ +EXPAT_CONTEXT_BYTES = @EXPAT_CONTEXT_BYTES@ +EXPAT_DTD = @EXPAT_DTD@ +EXPAT_LARGE_SIZE = @EXPAT_LARGE_SIZE@ +EXPAT_MIN_SIZE = @EXPAT_MIN_SIZE@ +EXPAT_NS = @EXPAT_NS@ FGREP = @FGREP@ +FILECMD = @FILECMD@ FILEMAP = @FILEMAP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -267,6 +279,8 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAGE = @LIBAGE@ LIBCURRENT = @LIBCURRENT@ +LIBDIR_BASENAME = @LIBDIR_BASENAME@ +LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBREVISION = @LIBREVISION@ LIBS = @LIBS@ @@ -275,6 +289,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ @@ -296,9 +311,12 @@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIZEOF_VOID_P = @SIZEOF_VOID_P@ +SO_MAJOR = @SO_MAJOR@ +SO_MINOR = @SO_MINOR@ +SO_PATCH = @SO_PATCH@ STRIP = @STRIP@ VERSION = @VERSION@ -_EXPAT_OUTPUT_NAME = @_EXPAT_OUTPUT_NAME@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -361,7 +379,7 @@ xmlwf_SOURCES = \ @FILEMAP@.c xmlwf_CPPFLAGS = @AM_CPPFLAGS@ -I$(srcdir)/../lib $(am__append_1) -xmlwf_LDFLAGS = @AM_LDFLAGS@ $(am__append_2) +xmlwf_LDFLAGS = @AM_LDFLAGS@ @LIBM@ $(am__append_2) EXTRA_DIST = \ codepage.h \ ct.c \ @@ -378,7 +396,7 @@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -402,9 +420,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @@ -612,7 +630,6 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff --git a/3rdparty/expat/xmlwf/codepage.c b/3rdparty/expat/xmlwf/codepage.c index 44d2035811d..8e0b5d199cd 100644 --- a/3rdparty/expat/xmlwf/codepage.c +++ b/3rdparty/expat/xmlwf/codepage.c @@ -7,7 +7,11 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> + Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2005-2006 Karl Waclawek <karl@waclawek.net> + Copyright (c) 2016-2019 Sebastian Pipping <sebastian@pipping.org> + Copyright (c) 2019 David Loffredo <loffredo@steptools.com> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining diff --git a/3rdparty/expat/xmlwf/codepage.h b/3rdparty/expat/xmlwf/codepage.h index 1b75d58365f..75ddbce4a45 100644 --- a/3rdparty/expat/xmlwf/codepage.h +++ b/3rdparty/expat/xmlwf/codepage.h @@ -7,7 +7,9 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> + Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2016-2017 Sebastian Pipping <sebastian@pipping.org> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining diff --git a/3rdparty/expat/xmlwf/ct.c b/3rdparty/expat/xmlwf/ct.c index dcf92bab568..d4c0e7a0a95 100644 --- a/3rdparty/expat/xmlwf/ct.c +++ b/3rdparty/expat/xmlwf/ct.c @@ -7,7 +7,8 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2016-2017 Sebastian Pipping <sebastian@pipping.org> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining diff --git a/3rdparty/expat/xmlwf/filemap.h b/3rdparty/expat/xmlwf/filemap.h index ef66114422f..5e0c70fa99b 100644 --- a/3rdparty/expat/xmlwf/filemap.h +++ b/3rdparty/expat/xmlwf/filemap.h @@ -7,7 +7,9 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> + Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2016-2017 Sebastian Pipping <sebastian@pipping.org> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining diff --git a/3rdparty/expat/xmlwf/readfilemap.c b/3rdparty/expat/xmlwf/readfilemap.c index d5b84f995ad..2cb53feef8d 100644 --- a/3rdparty/expat/xmlwf/readfilemap.c +++ b/3rdparty/expat/xmlwf/readfilemap.c @@ -7,7 +7,13 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> + Copyright (c) 2001-2004 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2002-2009 Karl Waclawek <karl@waclawek.net> + Copyright (c) 2016-2017 Sebastian Pipping <sebastian@pipping.org> + Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk> + Copyright (c) 2017 Franek Korta <fkorta@gmail.com> + Copyright (c) 2022 Sean McBride <sean@rogue-research.com> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -45,14 +51,14 @@ #if defined(_MSC_VER) # include <io.h> /* https://msdn.microsoft.com/en-us/library/wyssk1bs(v=vs.100).aspx */ -# define _EXPAT_read _read -# define _EXPAT_read_count_t int -# define _EXPAT_read_req_t unsigned int +# define EXPAT_read _read +# define EXPAT_read_count_t int +# define EXPAT_read_req_t unsigned int #else /* POSIX */ /* http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html */ -# define _EXPAT_read read -# define _EXPAT_read_count_t ssize_t -# define _EXPAT_read_req_t size_t +# define EXPAT_read read +# define EXPAT_read_count_t ssize_t +# define EXPAT_read_req_t size_t #endif #ifndef S_ISREG @@ -62,7 +68,7 @@ # ifndef S_IFMT # define S_IFMT _S_IFMT # endif -# define S_ISREG(m) (((m)&S_IFMT) == S_IFREG) +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif /* not S_ISREG */ #ifndef O_BINARY @@ -82,7 +88,7 @@ filemap(const tchar *name, void *arg) { size_t nbytes; int fd; - _EXPAT_read_count_t n; + EXPAT_read_count_t n; struct stat sb; void *p; @@ -120,14 +126,14 @@ filemap(const tchar *name, close(fd); return 0; } - n = _EXPAT_read(fd, p, (_EXPAT_read_req_t)nbytes); + n = EXPAT_read(fd, p, (EXPAT_read_req_t)nbytes); if (n < 0) { tperror(name); free(p); close(fd); return 0; } - if (n != (_EXPAT_read_count_t)nbytes) { + if (n != (EXPAT_read_count_t)nbytes) { ftprintf(stderr, T("%s: read unexpected number of bytes\n"), name); free(p); close(fd); diff --git a/3rdparty/expat/xmlwf/unixfilemap.c b/3rdparty/expat/xmlwf/unixfilemap.c index 0d0dc0424dc..d0ce9cc60a8 100644 --- a/3rdparty/expat/xmlwf/unixfilemap.c +++ b/3rdparty/expat/xmlwf/unixfilemap.c @@ -7,7 +7,11 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> + Copyright (c) 2001-2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2006 Karl Waclawek <karl@waclawek.net> + Copyright (c) 2016-2017 Sebastian Pipping <sebastian@pipping.org> + Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining diff --git a/3rdparty/expat/xmlwf/win32filemap.c b/3rdparty/expat/xmlwf/win32filemap.c index 0c9b7ecc5ff..a2db8eafc43 100644 --- a/3rdparty/expat/xmlwf/win32filemap.c +++ b/3rdparty/expat/xmlwf/win32filemap.c @@ -7,7 +7,10 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> + Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org> + Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -105,7 +108,7 @@ filemap(const TCHAR *name, static void win32perror(const TCHAR *s) { - LPVOID buf; + LPVOID buf = NULL; if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0, diff --git a/3rdparty/expat/xmlwf/xmlfile.c b/3rdparty/expat/xmlwf/xmlfile.c index e3d22c574c5..cd2533e0257 100644 --- a/3rdparty/expat/xmlwf/xmlfile.c +++ b/3rdparty/expat/xmlwf/xmlfile.c @@ -7,7 +7,15 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> + Copyright (c) 2002-2003 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2004-2006 Karl Waclawek <karl@waclawek.net> + Copyright (c) 2005-2007 Steven Solie <steven@solie.ca> + 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> + Copyright (c) 2024 Hanno Böck <hanno@gentoo.org> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -30,6 +38,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "expat_config.h" + #include <stdio.h> #include <stdlib.h> #include <stddef.h> @@ -38,9 +48,7 @@ #ifdef _WIN32 # include "winconfig.h" -#elif defined(HAVE_EXPAT_CONFIG_H) -# include <expat_config.h> -#endif /* ndef _WIN32 */ +#endif #include "expat.h" #include "internal.h" /* for UNUSED_P only */ @@ -64,11 +72,7 @@ # endif #endif -#ifdef _DEBUG -# define READ_SIZE 16 -#else -# define READ_SIZE (1024 * 8) -#endif +int g_read_size_bytes = 1024 * 8; typedef struct { XML_Parser parser; @@ -88,7 +92,8 @@ reportError(XML_Parser parser, const XML_Char *filename) { filename, XML_GetErrorLineNumber(parser), XML_GetErrorColumnNumber(parser), message); else - ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code); + ftprintf(stderr, T("%s: (unknown message %u)\n"), filename, + (unsigned int)code); } /* This implementation will give problems on files larger than INT_MAX. */ @@ -188,7 +193,7 @@ processStream(const XML_Char *filename, XML_Parser parser) { } for (;;) { int nread; - char *buf = (char *)XML_GetBuffer(parser, READ_SIZE); + char *buf = (char *)XML_GetBuffer(parser, g_read_size_bytes); if (! buf) { if (filename != NULL) close(fd); @@ -196,7 +201,7 @@ processStream(const XML_Char *filename, XML_Parser parser) { filename != NULL ? filename : T("xmlwf")); return 0; } - nread = read(fd, buf, READ_SIZE); + nread = read(fd, buf, g_read_size_bytes); if (nread < 0) { tperror(filename != NULL ? filename : T("STDIN")); if (filename != NULL) diff --git a/3rdparty/expat/xmlwf/xmlfile.h b/3rdparty/expat/xmlwf/xmlfile.h index 6e5d5b49eb7..579201ccf49 100644 --- a/3rdparty/expat/xmlwf/xmlfile.h +++ b/3rdparty/expat/xmlwf/xmlfile.h @@ -7,7 +7,10 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> + Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2005 Karl Waclawek <karl@waclawek.net> + Copyright (c) 2016-2023 Sebastian Pipping <sebastian@pipping.org> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -39,5 +42,7 @@ # define XML_FMT_INT_MOD "l" #endif +extern int g_read_size_bytes; + extern int XML_ProcessFile(XML_Parser parser, const XML_Char *filename, unsigned flags); diff --git a/3rdparty/expat/xmlwf/xmlmime.c b/3rdparty/expat/xmlwf/xmlmime.c index 39160d7198c..883e293dac4 100644 --- a/3rdparty/expat/xmlwf/xmlmime.c +++ b/3rdparty/expat/xmlwf/xmlmime.c @@ -7,7 +7,9 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2016-2018 Sebastian Pipping <sebastian@pipping.org> + Copyright (c) 2018 Marco Maggi <marco.maggi-ipsu@poste.it> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining diff --git a/3rdparty/expat/xmlwf/xmlmime.h b/3rdparty/expat/xmlwf/xmlmime.h index 0471286234a..591a8847760 100644 --- a/3rdparty/expat/xmlwf/xmlmime.h +++ b/3rdparty/expat/xmlwf/xmlmime.h @@ -7,7 +7,8 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2016-2017 Sebastian Pipping <sebastian@pipping.org> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining diff --git a/3rdparty/expat/xmlwf/xmltchar.h b/3rdparty/expat/xmlwf/xmltchar.h index d7e7b411b44..30283d086dd 100644 --- a/3rdparty/expat/xmlwf/xmltchar.h +++ b/3rdparty/expat/xmlwf/xmltchar.h @@ -7,7 +7,8 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2016-2021 Sebastian Pipping <sebastian@pipping.org> + Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -54,6 +55,8 @@ # define tmain wmain # define tremove _wremove # define tchar wchar_t +# define tcstof wcstof +# define tcstoull wcstoull #else /* not XML_UNICODE */ # define T(x) x # define ftprintf fprintf @@ -71,4 +74,6 @@ # define tmain main # define tremove remove # define tchar char +# define tcstof strtof +# define tcstoull strtoull #endif /* not XML_UNICODE */ diff --git a/3rdparty/expat/xmlwf/xmlwf.c b/3rdparty/expat/xmlwf/xmlwf.c index 5121fa1028e..2bcd4627f7f 100644 --- a/3rdparty/expat/xmlwf/xmlwf.c +++ b/3rdparty/expat/xmlwf/xmlwf.c @@ -7,7 +7,18 @@ |_| XML parser Copyright (c) 1997-2000 Thai Open Source Software Center Ltd - Copyright (c) 2000-2017 Expat development team + Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> + Copyright (c) 2001-2003 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> + Copyright (c) 2004-2009 Karl Waclawek <karl@waclawek.net> + Copyright (c) 2005-2007 Steven Solie <steven@solie.ca> + 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) 2020 Joe Orton <jorton@redhat.com> + Copyright (c) 2020 Kleber Tarcísio <klebertarcisio@yahoo.com.br> + Copyright (c) 2021 Tim Bray <tbray@textuality.com> + Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com> + Copyright (c) 2022 Sean McBride <sean@rogue-research.com> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -30,11 +41,15 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "expat_config.h" + #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <string.h> +#include <math.h> /* for isnan */ +#include <errno.h> #include "expat.h" #include "codepage.h" @@ -50,6 +65,14 @@ # include <wchar.h> #endif +enum ExitCode { + XMLWF_EXIT_SUCCESS = 0, + XMLWF_EXIT_INTERNAL_ERROR = 1, + XMLWF_EXIT_NOT_WELLFORMED = 2, + XMLWF_EXIT_OUTPUT_ERROR = 3, + XMLWF_EXIT_USAGE_ERROR = 4, +}; + /* Structures for handler user data */ typedef struct NotationList { struct NotationList *next; @@ -156,7 +179,7 @@ is equivalent to lexicographically comparing based on the character number. */ static int attcmp(const void *att1, const void *att2) { - return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2); + return tcscmp(*(const XML_Char *const *)att1, *(const XML_Char *const *)att2); } static void XMLCALL @@ -193,10 +216,10 @@ endElement(void *userData, const XML_Char *name) { static int nsattcmp(const void *p1, const void *p2) { - const XML_Char *att1 = *(const XML_Char **)p1; - const XML_Char *att2 = *(const XML_Char **)p2; + const XML_Char *att1 = *(const XML_Char *const *)p1; + const XML_Char *att2 = *(const XML_Char *const *)p2; int sep1 = (tcsrchr(att1, NSSEP) != 0); - int sep2 = (tcsrchr(att1, NSSEP) != 0); + int sep2 = (tcsrchr(att2, NSSEP) != 0); if (sep1 != sep2) return sep1 - sep2; return tcscmp(att1, att2); @@ -322,6 +345,13 @@ freeNotations(XmlwfUserData *data) { data->notationListHead = NULL; } +static void +cleanupUserData(XmlwfUserData *userData) { + free((void *)userData->currentDoctypeName); + userData->currentDoctypeName = NULL; + freeNotations(userData); +} + static int xcscmp(const XML_Char *xs, const XML_Char *xt) { while (*xs != 0 && *xt != 0) { @@ -341,8 +371,8 @@ xcscmp(const XML_Char *xs, const XML_Char *xt) { static int notationCmp(const void *a, const void *b) { - const NotationList *const n1 = *(NotationList **)a; - const NotationList *const n2 = *(NotationList **)b; + const NotationList *const n1 = *(const NotationList *const *)a; + const NotationList *const n2 = *(const NotationList *const *)b; return xcscmp(n1->notationName, n2->notationName); } @@ -842,47 +872,71 @@ showVersion(XML_Char *prog) { } } +#if defined(__GNUC__) +__attribute__((noreturn)) +#endif static void usage(const XML_Char *prog, int rc) { ftprintf( stderr, /* Generated with: * $ xmlwf/xmlwf_helpgen.sh + * To update, change xmlwf/xmlwf_helpgen.py, then paste the output of + * xmlwf/xmlwf_helpgen.sh in here. */ /* clang-format off */ - T("usage: %s [-s] [-n] [-p] [-x] [-e ENCODING] [-w] [-r] [-d DIRECTORY]\n") - T(" [-c | -m | -t] [-N]\n") - T(" [FILE [FILE ...]]\n") + T("usage:\n") + T(" %s [OPTIONS] [FILE ...]\n") + T(" %s -h|--help\n") + T(" %s -v|--version\n") T("\n") T("xmlwf - Determines if an XML document is well-formed\n") T("\n") T("positional arguments:\n") - T(" FILE file to process (default: STDIN)\n") + T(" FILE file to process (default: STDIN)\n") T("\n") T("input control arguments:\n") - T(" -s print an error if the document is not [s]tandalone\n") - T(" -n enable [n]amespace processing\n") - T(" -p enable processing external DTDs and [p]arameter entities\n") - T(" -x enable processing of e[x]ternal entities\n") - T(" -e ENCODING override any in-document [e]ncoding declaration\n") - T(" -w enable support for [W]indows code pages\n") - T(" -r disable memory-mapping and use normal file [r]ead IO calls instead\n") + T(" -s print an error if the document is not [s]tandalone\n") + T(" -n enable [n]amespace processing\n") + T(" -p enable processing of external DTDs and [p]arameter entities\n") + T(" -x enable processing of e[x]ternal entities\n") + T(" -e ENCODING override any in-document [e]ncoding declaration\n") + T(" -w enable support for [W]indows code pages\n") + T(" -r disable memory-mapping and use [r]ead calls instead\n") + T(" -g BYTES buffer size to request per call pair to XML_[G]etBuffer and read (default: 8 KiB)\n") + T(" -k when processing multiple files, [k]eep processing after first file with error\n") T("\n") T("output control arguments:\n") - T(" -d DIRECTORY output [d]estination directory\n") - T(" -c write a [c]opy of input XML, not canonical XML\n") - T(" -m write [m]eta XML, not canonical XML\n") - T(" -t write no XML output for [t]iming of plain parsing\n") - T(" -N enable adding doctype and [n]otation declarations\n") + T(" -d DIRECTORY output [d]estination directory\n") + T(" -c write a [c]opy of input XML, not canonical XML\n") + T(" -m write [m]eta XML, not canonical XML\n") + T(" -t write no XML output for [t]iming of plain parsing\n") + T(" -N enable adding doctype and [n]otation declarations\n") + T("\n") + T("billion laughs attack protection:\n") + T(" NOTE: If you ever need to increase these values for non-attack payload, please file a bug report.\n") + T("\n") + T(" -a FACTOR set maximum tolerated [a]mplification factor (default: 100.0)\n") + T(" -b BYTES set number of output [b]ytes needed to activate (default: 8 MiB)\n") + T("\n") + T("reparse deferral:\n") + T(" -q disable reparse deferral, and allow [q]uadratic parse runtime with large tokens\n") T("\n") T("info arguments:\n") - T(" -h show this [h]elp message and exit\n") - T(" -v show program's [v]ersion number and exit\n") + T(" -h, --help show this [h]elp message and exit\n") + T(" -v, --version show program's [v]ersion number and exit\n") + T("\n") + T("exit status:\n") + T(" 0 the input files are well-formed and the output (if requested) was written successfully\n") + T(" 1 could not allocate data structures, signals a serious problem with execution environment\n") + T(" 2 one or more input files were not well-formed\n") + T(" 3 could not create an output file\n") + T(" 4 command-line argument error\n") T("\n") T("xmlwf of libexpat is software libre, licensed under the MIT license.\n") - T("Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you!\n") + T("Please report bugs at https://github.com/libexpat/libexpat/issues -- thank you!\n") , /* clang-format on */ - prog); + prog, prog, prog); exit(rc); } @@ -891,6 +945,21 @@ usage(const XML_Char *prog, int rc) { int wmain(int argc, XML_Char **argv); #endif +#define XMLWF_SHIFT_ARG_INTO(constCharStarTarget, argc, argv, i, j) \ + { \ + if (argv[i][j + 1] == T('\0')) { \ + if (++i == argc) { \ + usage(argv[0], XMLWF_EXIT_USAGE_ERROR); \ + /* usage called exit(..), never gets here */ \ + } \ + constCharStarTarget = argv[i]; \ + } else { \ + constCharStarTarget = argv[i] + j + 1; \ + } \ + i++; \ + j = 0; \ + } + int tmain(int argc, XML_Char **argv) { int i, j; @@ -902,6 +971,15 @@ tmain(int argc, XML_Char **argv) { int useNamespaces = 0; int requireStandalone = 0; int requiresNotations = 0; + int continueOnError = 0; + + float attackMaximumAmplification = -1.0f; /* signaling "not set" */ + unsigned long long attackThresholdBytes = 0; + XML_Bool attackThresholdGiven = XML_FALSE; + + XML_Bool disableDeferral = XML_FALSE; + + int exitCode = XMLWF_EXIT_SUCCESS; enum XML_ParamEntityParsing paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; int useStdin = 0; @@ -917,9 +995,17 @@ tmain(int argc, XML_Char **argv) { if (j == 0) { if (argv[i][0] != T('-')) break; - if (argv[i][1] == T('-') && argv[i][2] == T('\0')) { - i++; - break; + if (argv[i][1] == T('-')) { + if (argv[i][2] == T('\0')) { + i++; + break; + } else if (tcscmp(argv[i] + 2, T("help")) == 0) { + usage(argv[0], XMLWF_EXIT_SUCCESS); + // usage called exit(..), never gets here + } else if (tcscmp(argv[i] + 2, T("version")) == 0) { + showVersion(argv[0]); + return XMLWF_EXIT_SUCCESS; + } } j++; } @@ -965,31 +1051,91 @@ tmain(int argc, XML_Char **argv) { j++; break; case T('d'): - if (argv[i][j + 1] == T('\0')) { - if (++i == argc) - usage(argv[0], 2); - outputDir = argv[i]; - } else - outputDir = argv[i] + j + 1; - i++; - j = 0; + XMLWF_SHIFT_ARG_INTO(outputDir, argc, argv, i, j); break; case T('e'): - if (argv[i][j + 1] == T('\0')) { - if (++i == argc) - usage(argv[0], 2); - encoding = argv[i]; - } else - encoding = argv[i] + j + 1; - i++; - j = 0; + XMLWF_SHIFT_ARG_INTO(encoding, argc, argv, i, j); break; case T('h'): - usage(argv[0], 0); - return 0; + usage(argv[0], XMLWF_EXIT_SUCCESS); + // usage called exit(..), never gets here case T('v'): showVersion(argv[0]); - return 0; + return XMLWF_EXIT_SUCCESS; + case T('g'): { + const XML_Char *valueText = NULL; + XMLWF_SHIFT_ARG_INTO(valueText, argc, argv, i, j); + + errno = 0; + XML_Char *afterValueText = (XML_Char *)valueText; + const long long read_size_bytes_candidate + = tcstoull(valueText, &afterValueText, 10); + if ((errno != 0) || (afterValueText[0] != T('\0')) + || (read_size_bytes_candidate < 1) + || (read_size_bytes_candidate > (INT_MAX / 2 + 1))) { + // This prevents tperror(..) from reporting misleading "[..]: Success" + errno = ERANGE; + tperror(T("invalid buffer size") T( + " (needs an integer from 1 to INT_MAX/2+1 i.e. 1,073,741,824 on most platforms)")); + exit(XMLWF_EXIT_USAGE_ERROR); + } + g_read_size_bytes = (int)read_size_bytes_candidate; + break; + } + case T('k'): + continueOnError = 1; + j++; + break; + case T('a'): { + const XML_Char *valueText = NULL; + XMLWF_SHIFT_ARG_INTO(valueText, argc, argv, i, j); + + errno = 0; + XML_Char *afterValueText = NULL; + attackMaximumAmplification = tcstof(valueText, &afterValueText); + if ((errno != 0) || (afterValueText[0] != T('\0')) + || isnan(attackMaximumAmplification) + || (attackMaximumAmplification < 1.0f)) { + // This prevents tperror(..) from reporting misleading "[..]: Success" + errno = ERANGE; + tperror(T("invalid amplification limit") T( + " (needs a floating point number greater or equal than 1.0)")); + exit(XMLWF_EXIT_USAGE_ERROR); + } +#if XML_GE == 0 + ftprintf(stderr, + T("Warning: Given amplification limit ignored") + T(", xmlwf has been compiled without DTD/GE support.\n")); +#endif + break; + } + case T('b'): { + const XML_Char *valueText = NULL; + XMLWF_SHIFT_ARG_INTO(valueText, argc, argv, i, j); + + errno = 0; + XML_Char *afterValueText = (XML_Char *)valueText; + attackThresholdBytes = tcstoull(valueText, &afterValueText, 10); + if ((errno != 0) || (afterValueText[0] != T('\0'))) { + // This prevents tperror(..) from reporting misleading "[..]: Success" + errno = ERANGE; + tperror(T("invalid ignore threshold") + T(" (needs an integer from 0 to 2^64-1)")); + exit(XMLWF_EXIT_USAGE_ERROR); + } + attackThresholdGiven = XML_TRUE; +#if XML_GE == 0 + ftprintf(stderr, + T("Warning: Given attack threshold ignored") + T(", xmlwf has been compiled without DTD/GE support.\n")); +#endif + break; + } + case T('q'): { + disableDeferral = XML_TRUE; + j++; + break; + } case T('\0'): if (j > 1) { i++; @@ -998,7 +1144,8 @@ tmain(int argc, XML_Char **argv) { } /* fall through */ default: - usage(argv[0], 2); + usage(argv[0], XMLWF_EXIT_USAGE_ERROR); + // usage called exit(..), never gets here } } if (i == argc) { @@ -1017,7 +1164,32 @@ tmain(int argc, XML_Char **argv) { if (! parser) { tperror(T("Could not instantiate parser")); - exit(1); + exit(XMLWF_EXIT_INTERNAL_ERROR); + } + + if (attackMaximumAmplification != -1.0f) { +#if XML_GE == 1 + XML_SetBillionLaughsAttackProtectionMaximumAmplification( + parser, attackMaximumAmplification); +#endif + } + if (attackThresholdGiven) { +#if XML_GE == 1 + XML_SetBillionLaughsAttackProtectionActivationThreshold( + parser, attackThresholdBytes); +#else + (void)attackThresholdBytes; // silence -Wunused-but-set-variable +#endif + } + + if (disableDeferral) { + const XML_Bool success = XML_SetReparseDeferralEnabled(parser, XML_FALSE); + if (! success) { + // This prevents tperror(..) from reporting misleading "[..]: Success" + errno = EINVAL; + tperror(T("Failed to disable reparse deferral")); + exit(XMLWF_EXIT_INTERNAL_ERROR); + } } if (requireStandalone) @@ -1053,7 +1225,7 @@ tmain(int argc, XML_Char **argv) { * sizeof(XML_Char)); if (! outName) { tperror(T("Could not allocate memory")); - exit(1); + exit(XMLWF_EXIT_INTERNAL_ERROR); } tcscpy(outName, outputDir); tcscat(outName, delim); @@ -1061,7 +1233,14 @@ tmain(int argc, XML_Char **argv) { userData.fp = tfopen(outName, T("wb")); if (! userData.fp) { tperror(outName); - exit(3); + exitCode = XMLWF_EXIT_OUTPUT_ERROR; + free(outName); + XML_ParserFree(parser); + if (continueOnError) { + continue; + } else { + break; + } } setvbuf(userData.fp, NULL, _IOFBF, 16384); #ifdef XML_UNICODE @@ -1123,8 +1302,12 @@ tmain(int argc, XML_Char **argv) { } XML_ParserFree(parser); if (! result) { - exit(2); + exitCode = XMLWF_EXIT_NOT_WELLFORMED; + cleanupUserData(&userData); + if (! continueOnError) { + break; + } } } - return 0; + return exitCode; } diff --git a/3rdparty/expat/xmlwf/xmlwf_helpgen.py b/3rdparty/expat/xmlwf/xmlwf_helpgen.py index 939286e5c2c..3d32f5d148b 100755 --- a/3rdparty/expat/xmlwf/xmlwf_helpgen.py +++ b/3rdparty/expat/xmlwf/xmlwf_helpgen.py @@ -6,7 +6,8 @@ # \___/_/\_\ .__/ \__,_|\__| # |_| XML parser # -# Copyright (c) 2019 Expat development team +# Copyright (c) 2019-2023 Sebastian Pipping <sebastian@pipping.org> +# Copyright (c) 2021 Tim Bray <tbray@textuality.com> # Licensed under the MIT license: # # Permission is hereby granted, free of charge, to any person obtaining @@ -31,11 +32,25 @@ import argparse epilog = """ +exit status: + 0 the input files are well-formed and the output (if requested) was written successfully + 1 could not allocate data structures, signals a serious problem with execution environment + 2 one or more input files were not well-formed + 3 could not create an output file + 4 command-line argument error + xmlwf of libexpat is software libre, licensed under the MIT license. -Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you! +Please report bugs at https://github.com/libexpat/libexpat/issues -- thank you! +""" + +usage = """ + %(prog)s [OPTIONS] [FILE ...] + %(prog)s -h|--help + %(prog)s -v|--version """ parser = argparse.ArgumentParser(prog='xmlwf', add_help=False, + usage=usage, description='xmlwf - Determines if an XML document is well-formed', formatter_class=argparse.RawTextHelpFormatter, epilog=epilog) @@ -43,11 +58,13 @@ parser = argparse.ArgumentParser(prog='xmlwf', add_help=False, input_related = parser.add_argument_group('input control arguments') input_related.add_argument('-s', action='store_true', help='print an error if the document is not [s]tandalone') input_related.add_argument('-n', action='store_true', help='enable [n]amespace processing') -input_related.add_argument('-p', action='store_true', help='enable processing external DTDs and [p]arameter entities') +input_related.add_argument('-p', action='store_true', help='enable processing of external DTDs and [p]arameter entities') input_related.add_argument('-x', action='store_true', help='enable processing of e[x]ternal entities') input_related.add_argument('-e', action='store', metavar='ENCODING', help='override any in-document [e]ncoding declaration') input_related.add_argument('-w', action='store_true', help='enable support for [W]indows code pages') -input_related.add_argument('-r', action='store_true', help='disable memory-mapping and use normal file [r]ead IO calls instead') +input_related.add_argument('-r', action='store_true', help='disable memory-mapping and use [r]ead calls instead') +input_related.add_argument('-g', metavar='BYTES', help='buffer size to request per call pair to XML_[G]etBuffer and read (default: 8 KiB)') +input_related.add_argument('-k', action='store_true', help='when processing multiple files, [k]eep processing after first file with error') output_related = parser.add_argument_group('output control arguments') output_related.add_argument('-d', action='store', metavar='DIRECTORY', help='output [d]estination directory') @@ -57,12 +74,24 @@ output_mode.add_argument('-m', action='store_true', help='write [m]eta XML, not output_mode.add_argument('-t', action='store_true', help='write no XML output for [t]iming of plain parsing') output_related.add_argument('-N', action='store_true', help='enable adding doctype and [n]otation declarations') +billion_laughs = parser.add_argument_group('billion laughs attack protection', + description='NOTE: ' + 'If you ever need to increase these values ' + 'for non-attack payload, please file a bug report.') +billion_laughs.add_argument('-a', metavar='FACTOR', + help='set maximum tolerated [a]mplification factor (default: 100.0)') +billion_laughs.add_argument('-b', metavar='BYTES', help='set number of output [b]ytes needed to activate (default: 8 MiB)') + +reparse_deferral = parser.add_argument_group('reparse deferral') +reparse_deferral.add_argument('-q', metavar='FACTOR', + help='disable reparse deferral, and allow [q]uadratic parse runtime with large tokens') + parser.add_argument('files', metavar='FILE', nargs='*', help='file to process (default: STDIN)') info = parser.add_argument_group('info arguments') info = info.add_mutually_exclusive_group() -info.add_argument('-h', action='store_true', help='show this [h]elp message and exit') -info.add_argument('-v', action='store_true', help='show program\'s [v]ersion number and exit') +info.add_argument('-h', '--help', action='store_true', help='show this [h]elp message and exit') +info.add_argument('-v', '--version', action='store_true', help='show program\'s [v]ersion number and exit') if __name__ == '__main__': diff --git a/3rdparty/expat/xmlwf/xmlwf_helpgen.sh b/3rdparty/expat/xmlwf/xmlwf_helpgen.sh index 6b0fbf929a0..864e47086d1 100755 --- a/3rdparty/expat/xmlwf/xmlwf_helpgen.sh +++ b/3rdparty/expat/xmlwf/xmlwf_helpgen.sh @@ -6,7 +6,7 @@ # \___/_/\_\ .__/ \__,_|\__| # |_| XML parser # -# Copyright (c) 2019 Expat development team +# Copyright (c) 2019-2021 Sebastian Pipping <sebastian@pipping.org> # Licensed under the MIT license: # # Permission is hereby granted, free of charge, to any person obtaining @@ -29,7 +29,8 @@ # USE OR OTHER DEALINGS IN THE SOFTWARE. ./xmlwf/xmlwf_helpgen.py | sed \ - -e 's,usage: xmlwf,usage: %s,' \ + -e 's,usage: ,usage:,' \ + -e 's, xmlwf, %s,' \ -e 's, \[-h | -v\],,' \ -e 's,^, T(",' \ -e 's,$,\\n"),' |