Commit Graph

3050 Commits

Author SHA1 Message Date
Sebastian Pipping
100bc7072c README.md: Make CMake config mode example more clear 2021-05-22 19:07:49 +02:00
Sebastian Pipping
192af39be0 Changes: Document Autotools CMake file fixes 2021-05-21 13:15:34 +02:00
Sebastian Pipping
43142f0bab cmake/autotools: Fix generated expat-noconfig.cmake for macOS and MinGW 2021-05-21 00:14:36 +02:00
Sebastian Pipping
09ec4ff9c1 cmake/autotools: Use AC_CHECK_SIZEOF to fix 32bit support 2021-05-21 00:14:36 +02:00
Sebastian Pipping
4107aca9cb expat.iss: Use URLs with SSL 2021-05-14 22:14:54 +02:00
Sebastian Pipping
2c9230f611 Increase precision in existing MIT headers based on Git history 2021-05-14 22:14:54 +02:00
Sebastian Pipping
1b782d2fef doc/xmlwf.xml: Drop two XML comments of little value 2021-05-14 22:10:39 +02:00
Sebastian Pipping
99aec2fc77 doc/xmlwf.xml: Add GNU FDL 1.1 copyright header 2021-05-14 22:10:39 +02:00
Sebastian Pipping
b19cc837ef expat.iss: Add MIT header 2021-05-14 22:10:39 +02:00
Sebastian Pipping
ad937138e9 CMake: Streamline existing copyright header 2021-05-14 22:10:39 +02:00
Sebastian Pipping
77cfb8f4cd tests: Cover accounting of CDATA sections inside of general entities 2021-05-14 20:46:09 +02:00
Sebastian Pipping
60959f2b49 lib: Fix accounting of CDATA sections inside of general entities 2021-05-14 20:46:09 +02:00
Sebastian Pipping
31bce2cc81
Merge pull request #481 from libexpat/issue-471-cmake-support-build-shared-libs
CMake: Support variable BUILD_SHARED_LIBS (fixes #471)
2021-05-13 18:33:26 +02:00
Sebastian Pipping
4597195fa3 README.md: Add total download count badges 2021-05-13 17:20:07 +02:00
Sebastian Pipping
7e08029271 Changes: Document support for CMake variable BUILD_SHARED_LIBS 2021-05-12 15:05:25 +02:00
Sebastian Pipping
9cc3ca3e36 CMake: Support standard variable BUILD_SHARED_LIBS
https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html
2021-05-12 13:59:35 +02:00
Sebastian Pipping
309cd4aa4b
Merge pull request #466 from libexpat/protect-against-billion-laughs-attacks
[CVE-2013-0340, CWE-776] Protect against billion laughs attacks (fixes #34)
2021-05-11 14:53:22 +02:00
Sebastian Pipping
99bf4c370f doc/reference.html: Upgrade to OK.css 1.0.3 2021-05-08 22:14:06 +02:00
Sebastian Pipping
3f2f878662 Changes: Document protection against billion laughs attacks 2021-05-07 18:25:08 +02:00
Sebastian Pipping
5dbc857f47 tests: Cover helper unsignedCharToPrintable 2021-05-07 18:25:08 +02:00
Sebastian Pipping
e9d8f11558 tests: Cover billion laughs attack protection API 2021-05-07 18:25:07 +02:00
Sebastian Pipping
899c00e613 doc/reference.html: Document billion laughs attack protection API 2021-05-07 18:25:07 +02:00
Sebastian Pipping
bf87849598 xmlwf.1: Document arguments -a and -b 2021-05-07 18:25:07 +02:00
Sebastian Pipping
c6223b3b0f xmlwf: Add support for custom attack protection parameters 2021-05-07 18:25:07 +02:00
Sebastian Pipping
65cddaa4e9 xmlwf: Include expat_config.h so we can check for macro XML_DTD 2021-05-07 18:25:07 +02:00
Sebastian Pipping
271efb6069 tests: Cover accounting 2021-05-07 18:25:07 +02:00
Sebastian Pipping
29c3748788 lib: Make EXPAT_ENTROPY_DEBUG consistent with other EXPAT_*_DEBUG variables 2021-05-07 18:25:07 +02:00
Sebastian Pipping
857fdc4c3b lib: Add prefix "expat: " to EXPAT_ENTROPY_DEBUG=1 stderr output 2021-05-07 18:25:07 +02:00
Sebastian Pipping
8af7d22ff0 lib: Allow test suite to access raw accounting values 2021-05-07 18:25:07 +02:00
Sebastian Pipping
fcd0e14c3e lib: Address Cppcheck 2.4.1 warning "uninitvar" 2021-05-07 18:25:07 +02:00
Sebastian Pipping
b1d039607d lib: Protect against billion laughs attacks (approach 3.0.21) 2021-05-07 18:25:07 +02:00
Sebastian Pipping
1e053c698b Autotools|CMake: Suppress -Wpedantic-ms-format false positives
Addresses warning:
ISO C does not support the ‘I64’ ms_printf length modifier.

It seems correct and relevant with __USE_MINGW_ANSI_STDIO, only.
And -Werror doesn't tolerate false positives...
2021-05-07 18:25:07 +02:00
Sebastian Pipping
55dbc44200 doc/reference.html: Fix XML validity 2021-05-07 17:04:06 +02:00
Sebastian Pipping
283f024a4e xmlwf.1: Fix DocBook validity 2021-05-07 17:04:06 +02:00
Sebastian Pipping
edf095116c xmlwf.1: Add public external DocBook identifier to doctype
.. so that we can throw validation tools at it.
2021-05-07 17:04:06 +02:00
Sebastian Pipping
6f47cee760 doc/reference.html: Introduce <h4> headings for API functions 2021-05-04 23:49:05 +02:00
Sebastian Pipping
30c4aa85f5 doc/reference.html: Replace footer, encourage bug reports 2021-05-04 23:49:03 +02:00
Sebastian Pipping
e13d94b426 doc/reference.html: Simplify header 2021-05-04 23:49:03 +02:00
Sebastian Pipping
3596977d9d doc/reference.html: Migrate to OK.css
Precisely this version:
ab0e43d64b/dist/ok.min.css
2021-05-04 23:49:00 +02:00
Sebastian Pipping
888566e418 doc/reference.html: Fix latest release version 2021-05-04 21:14:53 +02:00
Sebastian Pipping
f5dd8a9a5a doc/reference.html: Add missing space after "Note:" 2021-05-04 21:14:53 +02:00
Sebastian Pipping
988bff10cd doc/reference.html: Always start uppercase after "Note: " 2021-05-04 21:14:53 +02:00
Sebastian Pipping
df42f935bf Increase precision in existing MIT headers based on Git history 2021-05-02 19:53:29 +02:00
Sebastian Pipping
8c6f0369db Add missing MIT headers 2021-05-02 19:53:29 +02:00
Sebastian Pipping
bb3cf96dbe Pump up oneline MIT headers to full ones 2021-05-02 19:53:29 +02:00
Sebastian Pipping
ec3186f7ac conftools: Delete unused legacy helper PrintPath 2021-05-02 00:50:54 +02:00
Sebastian Pipping
8755b82355 apply-clang-format.sh: Support formatting only selected files 2021-04-30 21:09:05 +02:00
Sebastian Pipping
ab8830f72c apply-clang-format.sh: Extract variable clang_format_args 2021-04-30 21:09:05 +02:00
Sebastian Pipping
ed36812db2 lib: Fix macro IS_INVALID_CHAR (for UTF-16 with macro XML_MIN_SIZE defined)
What happens is that with macro XML_MIN_SIZE defined,
for UTF-16 macro IS_INVALID_CHAR was being set to ..

> #define IS_INVALID_CHAR(enc, p, n)  (AS_NORMAL_ENCODING(enc)->isInvalid##n(enc, p))

.. which calls NULL pointers in .isInvalid{2,3,4} at runtime.

For UTF-16 we actually need what xmltok_impl.c does for macro
IS_INVALID_CHAR when it has not yet been defined:

> #  ifndef IS_INVALID_CHAR
> #    define IS_INVALID_CHAR(enc, ptr, n) (0)
> #  endif

So the fix is a combination of these two:
- Use .isInvalid{2,3,4} where needed and available and
- return 0/false for UTF-16 where .isInvalid{2,3,4} are NULL.
2021-04-26 14:18:00 +02:00
Sebastian Pipping
3b1b81f028 lib: Add comments about effect of XML_MIN_SIZE to xmltok_impl.c 2021-04-26 14:18:00 +02:00
Sebastian Pipping
841338da7f Revert "runtests.c: Fix compiler warning "unused function" with -DEXPAT_MIN_SIZE=ON"
This reverts commit 76f2beee81.
2021-04-25 22:51:23 +02:00
Sebastian Pipping
72cdab2aeb Revert "runtests.c: Workaround issue with combining XML_MIN_SIZE and ASan (#332)"
This reverts commit 48d4929bff.
2021-04-25 22:51:23 +02:00
Sebastian Pipping
1a5ae0e4c0 Changes: Document improvements to the man page 2021-04-25 19:13:00 +02:00
Sebastian Pipping
1f75b7fbac xmlwf.1: Bump date of last modification 2021-04-25 19:11:14 +02:00
Sebastian Pipping
dd77046dc3 xmlwf.1: Be more precise in section "author" 2021-04-25 19:11:14 +02:00
Sebastian Pipping
de34e8ce15 xmlwf.1: Use <command>&dhpackage;</command> where missing 2021-04-25 19:11:14 +02:00
Sebastian Pipping
a1c3ac908c xmlwf.1: Improve links in section "see also" 2021-04-25 19:11:14 +02:00
Sebastian Pipping
506600c59f xmlwf.1: Drop section "alternatives" that contains only dead links 2021-04-25 19:11:14 +02:00
Sebastian Pipping
0d21b17b2c xmlwf.1: Move argument -k in place with regard to alphabetic order 2021-04-25 19:10:51 +02:00
Sebastian Pipping
83f12b5627 xmlwf.1: Pull colon out of <emphasis> 2021-04-25 19:10:51 +02:00
Sebastian Pipping
1613b6ed1f xmlwf.1: Add <replaceable> where missing 2021-04-25 19:10:51 +02:00
Sebastian Pipping
c028d9b280 xmlwf: Simplify synopsis 2021-04-25 17:49:21 +02:00
Sebastian Pipping
8d1bd6ff2c Resolve macro HAVE_EXPAT_CONFIG_H 2021-04-22 00:11:28 +02:00
Sebastian Pipping
10d3429621
Merge pull request #463 from libexpat/small-xmlwf-refactoring
Small xmlwf refactoring
2021-04-20 13:34:54 +02:00
Tomas Korbar
8f53530dea Fix reference.html badly insterted ul tag
This fix makes no visible difference but stops static code analysers
from yielding warnings about not allowed ul inside paragraph.
2021-04-20 10:40:13 +02:00
Sebastian Pipping
810e240fde xmlwf: Extract exit code constants 2021-04-19 19:32:29 +02:00
Sebastian Pipping
385aeb477b xmlwf: Extract macro XMLWF_SHIFT_ARGUMENT 2021-04-19 19:30:12 +02:00
Sebastian Pipping
ae6c9b40af README.md: Extract two bullet points from a long sentence 2021-04-06 23:49:40 +02:00
Sebastian Pipping
dff64502da README.md: Emphasize lowercase and uppercase in CMake content 2021-04-06 23:48:12 +02:00
Sebastian Pipping
989dd1b2ca CMake: Support absolute paths for CMAKE_INSTALL_(LIB|INCLUDE)DIR (fixes #458) 2021-04-06 19:49:28 +02:00
Sebastian Pipping
f29b48cfca Unexpose function _INTERNAL_trim_to_complete_utf8_characters (#457) 2021-04-05 21:44:15 +02:00
Sebastian Pipping
b4f1429679 CMake: Give test suite access to internal symbols 2021-04-05 21:43:57 +02:00
Sebastian Pipping
f01a61402c Autotools: Give test suite access to internal symbols 2021-04-05 20:05:50 +02:00
Sebastian Pipping
bfe4b25b80 cmake/autotools/expat.cmake: Get back in sync with CI 2021-04-05 18:11:22 +02:00
Sebastian Pipping
9fafff73cd CMake: Be less rejective towards unsupported MSVC compilers for Conan (#454) 2021-03-26 18:05:10 +01:00
Sebastian Pipping
a29faca366
Merge pull request #453 from nschonni/patch-1
typo: Buildung -> Building
2021-03-25 19:11:19 +01:00
Sebastian Pipping
f592a964bd xmlwf.xml: Sync date of latest change 2021-03-25 18:37:33 +01:00
Nick Schonning
8fdc4c6c5f
typo: Buildung -> Building 2021-03-25 13:18:08 -04:00
Sebastian Pipping
cc414b64bd .gitignore: Add generated files at cmake/autotools/ 2021-03-25 01:28:34 +01:00
Sebastian Pipping
7d375b1bd9 Changes: Set release date for version 2.3.0 2021-03-24 21:05:04 +01:00
Sebastian Pipping
800c4d14e2 lib: Fix references to version 2.2.11 to be about 2.3.0, instead 2021-03-24 21:05:04 +01:00
Sebastian Pipping
3417b3e098 Bump version from 2.2.10 to 2.3.0 2021-03-24 21:05:04 +01:00
Sebastian Pipping
d0faa1ec14 README.md: Replace a "will" by a "may" to be more precise 2021-03-24 21:05:04 +01:00
Sebastian Pipping
4bd4bac268 README.md: Fix a SourceForge link leftover regarding Windows binaries (#1) 2021-03-24 21:05:04 +01:00
Sebastian Pipping
1ec7950e46 README.md: Replace Travis CI badge with GitHub Actions badge 2021-03-24 21:05:04 +01:00
Sebastian Pipping
f546f0658b README.md: Document use of libexpat from a CMake-based project 2021-03-24 21:05:04 +01:00
Sebastian Pipping
8f70f8c87f README.md: Add more structure 2021-03-24 20:10:02 +01:00
Sebastian Pipping
c992ac0fd7 README.md: Fix list syntax for some markdown interpreters 2021-03-24 20:09:54 +01:00
Sebastian Pipping
7991830172 Changes: Document #425, #426, #434, #435, #436, #437, #441, #443, #446 (#445) 2021-03-23 00:54:35 +01:00
Sebastian Pipping
1361370223 Changes: Improve documentation of #444 2021-03-23 00:54:35 +01:00
Sebastian Pipping
30ec88b351 configure.ac: Fix use of M4 macro "expat_version"
Regression introduced in fd9a7d649e
as part of pull request #450
2021-03-23 00:01:03 +01:00
Sebastian Pipping
b50ff5adaa Autotools: Install CMake files 2021-03-22 22:30:00 +01:00
Sebastian Pipping
fd9a7d649e configure.ac: Apply partial autoupdate-2.71
Addressed:
warning: The macro `AC_CONFIG_HEADER' is obsolete.

Not addressed yet:
warning: AC_PROG_CC_C99 is obsolete; use AC_PROG_CC
2021-03-22 18:28:11 +01:00
Sebastian Pipping
05f54b6c5e xmlwf.xml: Fix numerus for recent advent of -k 2021-03-20 18:20:09 +01:00
Sebastian Pipping
a6f3f2a3a2 xmlwf: Split off exit status 4 for invalid argument invokation 2021-03-20 18:20:09 +01:00
Sebastian Pipping
689cb6527f Changes: Fix inconsistent indentation 2021-03-20 18:20:09 +01:00
Sebastian Pipping
dd26478455 Windows: Drop support for Visual Studio <=14.0/2015 2021-03-20 15:38:49 +01:00
Sebastian Pipping
10e75ca59a Merge branch 'timbray-master' (#439) 2021-03-17 21:46:32 +01:00
Sebastian Pipping
4a6524e89e Changes: Document #439 2021-03-17 21:46:05 +01:00
Tim Bray
56c18c63ed Add argument -k to allow continuing after non-fatal errors 2021-03-16 20:40:26 -07:00
Sebastian Pipping
87176c5ce3 expat.h: Fix conmment typo regarding XML_ERROR_UNKNOWN_ENCODING 2021-03-17 02:12:18 +01:00
Sebastian Pipping
1955a4092e Bump version infro from 7:12:6 to 8:0:7 2021-03-16 18:34:06 +01:00
Sebastian Pipping
734698ba6a Changes: Fix inconsistent double blank line 2021-03-16 18:27:32 +01:00
Sebastian Pipping
29b9c6010c Changes: Document #442 2021-03-16 18:15:24 +01:00
Alex Richardson
13d4c51a17 CMake: Only set CMAKE_CXX_FLAGS after enable_language(CXX)
Otherwise flags specified in a CMake cross-compilation toolchain (such as
CMAKE_CXX_FLAGS_INIT) will not be added. This could also affect native
builds but is much more likely to be noticed when cross-compiling due to
missing essential flags.
2021-03-16 15:57:05 +00:00
Sebastian Pipping
0e567d2ed1 fuzzers: Address Clang warning -Wunused-parameter 2021-03-10 16:21:00 +01:00
Sebastian Pipping
44d889e78c .travis.yml: Upgrade to Ubuntu Bionic 18.04.x LTS and Clang 11 2021-02-24 03:34:43 +01:00
Sebastian Pipping
af86899bf9 apply-clang-format.sh: Report on clang-format version 2021-02-24 03:34:43 +01:00
Sebastian Pipping
811c41e3be xmlparse.c: Reject missing call to XML_GetBuffer in XML_ParseBuffer
.. rather than running into undefined behavior.
2021-02-24 02:26:06 +01:00
Sebastian Pipping
88be19e487 configure.ac: Drop obsolescent macro AC_HEADER_STDC (#436) 2020-12-29 03:01:09 +01:00
tbeu
a86a16e2c5 Detect unsupported VS at configure time (and not at compile time) 2020-12-27 19:22:15 +01:00
Tim Gates
81e07895c2
docs: fix simple typo, wtihout -> without
There is a small typo in expat/tests/runtests.c.

Should read `without` rather than `wtihout`.
2020-12-17 21:14:40 +11:00
Sebastian Pipping
46698550ea Changes: Document #382 and #428 2020-10-30 10:10:53 +01:00
Sebastian Pipping
1e243aca3e tests: Show failure location for normal mode output as well 2020-10-25 21:14:18 +01:00
Sebastian Pipping
263c76e324 tests: Make argument -v more useful 2020-10-25 21:14:18 +01:00
Sebastian Pipping
6a7264e383 tests: Report actual failure location 2020-10-25 21:14:09 +01:00
Sebastian Pipping
bd4b55a680 tests: Make check for silence explain itself better 2020-10-25 18:40:38 +01:00
Sebastian Pipping
ea60ef34a7 Drop remaining support for Visual Studio 2008, 2010, 2012 (#422) 2020-10-03 21:30:13 +02:00
Sebastian Pipping
179a0c5526 CMake: Remove unused variable 2020-10-03 21:09:32 +02:00
Sebastian Pipping
c686d358b3 Set release date for 2.2.10 2020-10-03 00:49:39 +02:00
Sebastian Pipping
3265243064 Bump version info from 7:11:6 to 7:12:6 2020-10-03 00:49:39 +02:00
Sebastian Pipping
3af8f46e3f Bump version from 2.2.9 to 2.2.10 2020-10-03 00:49:33 +02:00
Sebastian Pipping
d0ad8e21ca Changes: Document #405 #356 #359 #394 #366 #412 #368 #369 2020-10-03 00:43:37 +02:00
Sebastian Pipping
5644f0fa8e CMake: Turn endif(..) into endif(), and else(..) into else()
Related documentation:
https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#isnt-the-expression-in-the-elseexpression-confusing
2020-10-03 00:43:37 +02:00
Sebastian Pipping
cdeadf8522 tests: Add missing static to address compiler warning
Warning was:
runtests.c:112:1: warning: no previous prototype for ‘tcase_add_test__ifdef_xml_dtd’ [-Wmissing-prototypes]
2020-10-03 00:43:37 +02:00
Sebastian Pipping
11796c2166 Changes: Document #424 2020-10-01 21:28:37 +02:00
Sebastian Pipping
559f90fed7 CMake: Support "make package" based on CPack
On Linux, this will create a file "expat-2.2.9-Linux.tar.gz"
with the following content:

$ tar tf expat-2.2.9-Linux.tar.gz | sort | grep -v '/$'
expat-2.2.9-Linux/bin/xmlwf
expat-2.2.9-Linux/include/expat_config.h
expat-2.2.9-Linux/include/expat_external.h
expat-2.2.9-Linux/include/expat.h
expat-2.2.9-Linux/lib64/cmake/expat-2.2.9/expat.cmake
expat-2.2.9-Linux/lib64/cmake/expat-2.2.9/expat-config.cmake
expat-2.2.9-Linux/lib64/cmake/expat-2.2.9/expat-config-version.cmake
expat-2.2.9-Linux/lib64/cmake/expat-2.2.9/expat-noconfig.cmake
expat-2.2.9-Linux/lib64/libexpat.so
expat-2.2.9-Linux/lib64/libexpat.so.1
expat-2.2.9-Linux/lib64/libexpat.so.1.6.11
expat-2.2.9-Linux/lib64/pkgconfig/expat.pc
expat-2.2.9-Linux/share/doc/expat/AUTHORS
expat-2.2.9-Linux/share/doc/expat/changelog
expat-2.2.9-Linux/share/man/man1/xmlwf.1
2020-10-01 21:23:00 +02:00
Sebastian Pipping
2e63ab0782 Merge branch 'gittiver-master' (#419) 2020-09-26 14:54:39 +02:00
Sebastian Pipping
373e974b11 Changes: Document #419 2020-09-26 14:52:44 +02:00
Sebastian Pipping
639e28fc2e qa.sh: Enable LeakSanitizer 2020-09-25 20:18:33 +02:00
Gulliver
20f824e8e8 added "new" behaviour for Policy CMP0077 which allows to control the build options by variables if lib is used by FetchContent of a super project 2020-09-18 18:59:38 +02:00
Sebastian Pipping
d8daead33e installer: Add missing file to fix build from installed sources (#409) 2020-09-10 20:01:04 +02:00
Sebastian Pipping
1bb22cd03a
Merge pull request #414 from libexpat/issue-413-allow-installation-of-pkgconfig-file-with-msvc
CMake: Introduce option EXPAT_BUILD_PKGCONFIG (fixes #413)
2020-08-21 22:52:19 +02:00
Sebastian Pipping
86283117f1 readme: Sync list of CMake options 2020-08-20 22:02:30 +02:00
Sebastian Pipping
f438563a78 CMake: Introduce option EXPAT_BUILD_PKGCONFIG (#413) 2020-08-20 21:59:18 +02:00
Boris Kolpackov
81ae3e7208 Get rid of unsigned integer overflow in column calculation
While unsigned integer overflow is well-defined, Android sanitizers treat it
as an error. We also have some in the SipHash implementation but those won't
be easy to get rid of.
2020-08-17 16:08:56 +02:00
Sebastian Pipping
990e3d07ea
Merge pull request #411 from libexpat/cmake-linker-flags
CMake: Consider use of CMAKE_{EXE,MODULE,SHARED}_LINKER_FLAGS
2020-07-17 23:58:05 +02:00
Sebastian Pipping
e94b0b243e CMake: Consider use of CMAKE_{EXE,MODULE,SHARED}_LINKER_FLAGS 2020-07-16 23:46:26 +02:00
Sebastian Pipping
fc0e2365c9 Be more correct about const correctness on the inside 2020-07-16 21:09:00 +02:00
Sebastian Pipping
72227166b9 Changes: Document #408 2020-07-15 17:36:31 +02:00
Sebastian Pipping
da7cda3a85 CMake: Get expat target name back to constant "expat" 2020-07-10 19:33:34 +02:00
Sebastian Pipping
308d470e00 Changes: Document #406 2020-06-22 19:58:33 +02:00
Kleber Tarcísio
12a7276f3e xmlwf: Checks value after calling malloc 2020-06-22 19:56:34 +02:00
Sebastian Pipping
13bb381d29 xmlparse.c: Fix reading uninitialized variable (#404) 2020-05-28 01:57:06 +02:00
Sebastian Pipping
867bb34373 Merge branch 'notroj-xmlwf-doc-exitcode' (#403) 2020-05-13 14:42:18 +02:00
Sebastian Pipping
49ef210fc8 Changes: Document #403 2020-05-13 14:40:29 +02:00
Joe Orton
f1634dbaea Update xmlwf to exit with 3 if an output file could not be opened.
Update xmlwf exit code docs per review.
2020-05-13 08:36:56 +01:00
Joe Orton
38cfc7165f Document the exit codes for xmlwf. 2020-05-12 09:28:40 +01:00
Sebastian Pipping
f2172ff9bf Changes: Document #398 2020-04-20 15:21:25 +02:00
Ben Wagner
49c165c5a8 Don't add to NULL in iterator.
In C it is undefined to add anything to NULL. Clang recently began
taking advantage of this and can assume that if anything is added or
subtracted from a pointer that the pointer can be assumed non-NULL. The
Address Sanitizer has been updated to report when this happens at
runtime and produces messages like

expat/lib/xmlparse.c:6509:23: runtime error: applying zero offset to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior expat/lib/xmlparse.c:6509:23

This can be mitigated with 'p ? p + n : NULL' which optimizes to just
the add in all optimizing compilers, but avoids the undefined behavior.
2020-04-07 13:12:18 -04:00