diff options
Diffstat (limited to 'contrib/expat/xmlwf')
| -rw-r--r-- | contrib/expat/xmlwf/Makefile.in | 37 | ||||
| -rw-r--r-- | contrib/expat/xmlwf/unixfilemap.c | 6 | ||||
| -rw-r--r-- | contrib/expat/xmlwf/xmlfile.c | 25 | ||||
| -rw-r--r-- | contrib/expat/xmlwf/xmlwf.c | 21 | ||||
| -rwxr-xr-x | contrib/expat/xmlwf/xmlwf_helpgen.py | 18 | 
5 files changed, 72 insertions, 35 deletions
| diff --git a/contrib/expat/xmlwf/Makefile.in b/contrib/expat/xmlwf/Makefile.in index 480fd3e04103..07f2423aea10 100644 --- a/contrib/expat/xmlwf/Makefile.in +++ b/contrib/expat/xmlwf/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.5 from Makefile.am. +# Makefile.in generated by automake 1.18.1 from Makefile.am.  # @configure_input@ -# Copyright (C) 1994-2021 Free Software Foundation, Inc. +# Copyright (C) 1994-2025 Free Software Foundation, Inc.  # This Makefile.in is free software; the Free Software Foundation  # gives unlimited permission to copy and/or distribute it, @@ -100,6 +100,8 @@ am__make_running_with_option = \    test $$has_opt = yes  am__make_dryrun = (target_option=n; $(am__make_running_with_option))  am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +am__rm_f = rm -f $(am__rm_f_notfound) +am__rm_rf = rm -rf $(am__rm_f_notfound)  pkgdatadir = $(datadir)/@PACKAGE@  pkgincludedir = $(includedir)/@PACKAGE@  pkglibdir = $(libdir)/@PACKAGE@ @@ -328,8 +330,10 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@  am__include = @am__include@  am__leading_dot = @am__leading_dot@  am__quote = @am__quote@ +am__rm_f_notfound = @am__rm_f_notfound@  am__tar = @am__tar@  am__untar = @am__untar@ +am__xargs_n = @am__xargs_n@  bindir = @bindir@  build = @build@  build_alias = @build_alias@ @@ -464,16 +468,11 @@ uninstall-binPROGRAMS:  	`; \  	test -n "$$list" || exit 0; \  	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ -	cd "$(DESTDIR)$(bindir)" && rm -f $$files +	cd "$(DESTDIR)$(bindir)" && $(am__rm_f) $$files  clean-binPROGRAMS: -	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ -	echo " rm -f" $$list; \ -	rm -f $$list || exit $$?; \ -	test -n "$(EXEEXT)" || exit 0; \ -	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ -	echo " rm -f" $$list; \ -	rm -f $$list +	$(am__rm_f) $(bin_PROGRAMS) +	test -z "$(EXEEXT)" || $(am__rm_f) $(bin_PROGRAMS:$(EXEEXT)=)  xmlwf$(EXEEXT): $(xmlwf_OBJECTS) $(xmlwf_DEPENDENCIES) $(EXTRA_xmlwf_DEPENDENCIES)   	@rm -f xmlwf$(EXEEXT) @@ -492,7 +491,7 @@ distclean-compile:  $(am__depfiles_remade):  	@$(MKDIR_P) $(@D) -	@echo '# dummy' >$@-t && $(am__mv) $@-t $@ +	@: >>$@  am--depfiles: $(am__depfiles_remade) @@ -630,6 +629,7 @@ cscopelist-am: $(am__tagged_files)  distclean-tags:  	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +  distdir: $(BUILT_SOURCES)  	$(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -694,8 +694,8 @@ mostlyclean-generic:  clean-generic:  distclean-generic: -	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) +	-$(am__rm_f) $(CONFIG_CLEAN_FILES) +	-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)  maintainer-clean-generic:  	@echo "This command is intended for maintainers to use" @@ -705,7 +705,7 @@ clean: clean-am  clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am  distclean: distclean-am -		-rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po +	-rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po  	-rm -f ./$(DEPDIR)/xmlwf-codepage.Po  	-rm -f ./$(DEPDIR)/xmlwf-xmlfile.Po  	-rm -f ./$(DEPDIR)/xmlwf-xmlwf.Po @@ -754,7 +754,7 @@ install-ps-am:  installcheck-am:  maintainer-clean: maintainer-clean-am -		-rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po +	-rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po  	-rm -f ./$(DEPDIR)/xmlwf-codepage.Po  	-rm -f ./$(DEPDIR)/xmlwf-xmlfile.Po  	-rm -f ./$(DEPDIR)/xmlwf-xmlwf.Po @@ -798,3 +798,10 @@ uninstall-am: uninstall-binPROGRAMS  # Tell versions [3.59,3.63) of GNU make to not export all variables.  # Otherwise a system limit (for SysV at least) may be exceeded.  .NOEXPORT: + +# Tell GNU make to disable its built-in pattern rules. +%:: %,v +%:: RCS/%,v +%:: RCS/% +%:: s.% +%:: SCCS/s.% diff --git a/contrib/expat/xmlwf/unixfilemap.c b/contrib/expat/xmlwf/unixfilemap.c index d0ce9cc60a8a..d2e0b174680b 100644 --- a/contrib/expat/xmlwf/unixfilemap.c +++ b/contrib/expat/xmlwf/unixfilemap.c @@ -10,7 +10,7 @@     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) 2016-2025 Sebastian Pipping <sebastian@pipping.org>     Copyright (c) 2017      Rhodri James <rhodri@wildebeest.org.uk>     Licensed under the MIT license: @@ -41,6 +41,7 @@  #include <errno.h>  #include <string.h>  #include <stdio.h> +#include <stdlib.h> // NULL  #include <unistd.h>  #ifndef MAP_FILE @@ -93,8 +94,7 @@ filemap(const tchar *name,      close(fd);      return 1;    } -  p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ, MAP_FILE | MAP_PRIVATE, -                   fd, (off_t)0); +  p = mmap(NULL, nbytes, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, (off_t)0);    if (p == (void *)-1) {      tperror(name);      close(fd); diff --git a/contrib/expat/xmlwf/xmlfile.c b/contrib/expat/xmlwf/xmlfile.c index 9c4f7f8dbadd..ce0b61217ed7 100644 --- a/contrib/expat/xmlwf/xmlfile.c +++ b/contrib/expat/xmlwf/xmlfile.c @@ -11,7 +11,7 @@     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) 2016-2025 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> @@ -56,12 +56,19 @@  #include "xmltchar.h"  #include "filemap.h" +/* Function "read": */  #if defined(_MSC_VER)  #  include <io.h> -#endif - -#ifdef HAVE_UNISTD_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 +#else /* POSIX */  #  include <unistd.h> +/* https://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  #endif  #ifndef O_BINARY @@ -89,8 +96,8 @@ reportError(XML_Parser parser, const XML_Char *filename) {      ftprintf(stdout,               T("%s") T(":%") T(XML_FMT_INT_MOD) T("u") T(":%")                   T(XML_FMT_INT_MOD) T("u") T(": %s\n"), -             filename, XML_GetErrorLineNumber(parser), -             XML_GetErrorColumnNumber(parser), message); +             filename, XML_GetCurrentLineNumber(parser), +             XML_GetCurrentColumnNumber(parser), message);    else      ftprintf(stderr, T("%s: (unknown message %u)\n"), filename,               (unsigned int)code); @@ -192,7 +199,7 @@ processStream(const XML_Char *filename, XML_Parser parser) {      }    }    for (;;) { -    int nread; +    EXPAT_read_count_t nread;      char *buf = (char *)XML_GetBuffer(parser, g_read_size_bytes);      if (! buf) {        if (filename != NULL) @@ -201,14 +208,14 @@ processStream(const XML_Char *filename, XML_Parser parser) {                 filename != NULL ? filename : T("xmlwf"));        return 0;      } -    nread = read(fd, buf, g_read_size_bytes); +    nread = EXPAT_read(fd, buf, (EXPAT_read_req_t)g_read_size_bytes);      if (nread < 0) {        tperror(filename != NULL ? filename : T("STDIN"));        if (filename != NULL)          close(fd);        return 0;      } -    if (XML_ParseBuffer(parser, nread, nread == 0) == XML_STATUS_ERROR) { +    if (XML_ParseBuffer(parser, (int)nread, nread == 0) == XML_STATUS_ERROR) {        reportError(parser, filename != NULL ? filename : T("STDIN"));        if (filename != NULL)          close(fd); diff --git a/contrib/expat/xmlwf/xmlwf.c b/contrib/expat/xmlwf/xmlwf.c index 7c0a8cd4d6a4..534f32170590 100644 --- a/contrib/expat/xmlwf/xmlwf.c +++ b/contrib/expat/xmlwf/xmlwf.c @@ -11,7 +11,7 @@     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) 2016-2025 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> @@ -305,7 +305,7 @@ static XML_Char *  xcsdup(const XML_Char *s) {    XML_Char *result;    int count = 0; -  int numBytes; +  size_t numBytes;    /* Get the length of the string, including terminator */    while (s[count++] != 0) { @@ -913,11 +913,11 @@ usage(const XML_Char *prog, int rc) {        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("amplification attack protection (e.g. billion laughs):\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("  -b BYTES       set number of output [b]ytes needed to activate (default: 8 MiB/64 MiB)\n")        T("\n")        T("reparse deferral:\n")        T("  -q             disable reparse deferral, and allow [q]uadratic parse runtime with large tokens\n") @@ -926,6 +926,16 @@ usage(const XML_Char *prog, int rc) {        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("environment variables:\n") +      T("  EXPAT_ACCOUNTING_DEBUG=(0|1|2|3)\n") +      T("                 Control verbosity of accounting debugging (default: 0)\n") +      T("  EXPAT_ENTITY_DEBUG=(0|1)\n") +      T("                 Control verbosity of entity debugging (default: 0)\n") +      T("  EXPAT_ENTROPY_DEBUG=(0|1)\n") +      T("                 Control verbosity of entropy debugging (default: 0)\n") +      T("  EXPAT_MALLOC_DEBUG=(0|1|2)\n") +      T("                 Control verbosity of allocation tracker (default: 0)\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") @@ -1171,12 +1181,15 @@ tmain(int argc, XML_Char **argv) {  #if XML_GE == 1        XML_SetBillionLaughsAttackProtectionMaximumAmplification(            parser, attackMaximumAmplification); +      XML_SetAllocTrackerMaximumAmplification(parser, +                                              attackMaximumAmplification);  #endif      }      if (attackThresholdGiven) {  #if XML_GE == 1        XML_SetBillionLaughsAttackProtectionActivationThreshold(            parser, attackThresholdBytes); +      XML_SetAllocTrackerActivationThreshold(parser, attackThresholdBytes);  #else        (void)attackThresholdBytes; // silence -Wunused-but-set-variable  #endif diff --git a/contrib/expat/xmlwf/xmlwf_helpgen.py b/contrib/expat/xmlwf/xmlwf_helpgen.py index 3d32f5d148b7..71f7baa43396 100755 --- a/contrib/expat/xmlwf/xmlwf_helpgen.py +++ b/contrib/expat/xmlwf/xmlwf_helpgen.py @@ -6,7 +6,7 @@  #                      \___/_/\_\ .__/ \__,_|\__|  #                               |_| XML parser  # -# Copyright (c) 2019-2023 Sebastian Pipping <sebastian@pipping.org> +# Copyright (c) 2019-2025 Sebastian Pipping <sebastian@pipping.org>  # Copyright (c) 2021      Tim Bray <tbray@textuality.com>  # Licensed under the MIT license:  # @@ -32,6 +32,16 @@  import argparse  epilog = """ +environment variables: +  EXPAT_ACCOUNTING_DEBUG=(0|1|2|3) +                 Control verbosity of accounting debugging (default: 0) +  EXPAT_ENTITY_DEBUG=(0|1) +                 Control verbosity of entity debugging (default: 0) +  EXPAT_ENTROPY_DEBUG=(0|1) +                 Control verbosity of entropy debugging (default: 0) +  EXPAT_MALLOC_DEBUG=(0|1|2) +                 Control verbosity of allocation tracker (default: 0) +  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 @@ -74,16 +84,16 @@ 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', +billion_laughs = parser.add_argument_group('amplification attack protection (e.g. billion laughs)',                                             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)') +billion_laughs.add_argument('-b', metavar='BYTES', help='set number of output [b]ytes needed to activate (default: 8 MiB/64 MiB)')  reparse_deferral = parser.add_argument_group('reparse deferral') -reparse_deferral.add_argument('-q', metavar='FACTOR', +reparse_deferral.add_argument('-q', action='store_true',                              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)') | 
