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
8d1bd6ff2c
Resolve macro HAVE_EXPAT_CONFIG_H
2021-04-22 00:11: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
f01a61402c
Autotools: Give test suite access to internal symbols
2021-04-05 20:05:50 +02: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
87176c5ce3
expat.h: Fix conmment typo regarding XML_ERROR_UNKNOWN_ENCODING
2021-03-17 02:12:18 +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
ea60ef34a7
Drop remaining support for Visual Studio 2008, 2010, 2012 ( #422 )
2020-10-03 21:30:13 +02:00
Sebastian Pipping
3af8f46e3f
Bump version from 2.2.9 to 2.2.10
2020-10-03 00:49:33 +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
fc0e2365c9
Be more correct about const correctness on the inside
2020-07-16 21:09:00 +02:00
Sebastian Pipping
13bb381d29
xmlparse.c: Fix reading uninitialized variable ( #404 )
2020-05-28 01:57:06 +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
Sebastian Pipping
ef09dbabd4
xmlparse.c: Fix undefined behavior for XML_UNICODE
...
Pointer arithmetic with NULL is undefined behavior.
This reverts c71f27573b
2020-03-20 05:31:40 +01:00
Sebastian Pipping
2db13ca57d
xmlwf: Add missing @AM_*FLAGS@
2020-03-18 00:32:06 +01:00
luz.paz
56893d4fbb
Fix source comment typos
...
Found via `codespell -q 3 -S ./testdata,./expat/Changes`
2019-11-04 07:52:31 -05:00
Sebastian Pipping
515f5d07c6
xmlparse.c: Improve warning regarding lack of high quality entropy ( #172 )
2019-10-26 15:23:09 +02:00
Sebastian Pipping
fc32dd491c
xmlparse.c: Limit declaration of rand_s to mingwrt <5.3.0
2019-10-13 13:06:05 +02:00
Vadim Zeitlin
52aead2583
Declare rand_s() for MinGW 32 ourselves
...
Runtime files for MinGW don't contain rand_s() declaration, even in
their latest version, so declare it ourselves to avoid the warning about
missing function declaration.
2019-10-06 22:12:25 +02:00
Sebastian Pipping
5123c8ed95
xmltok.c: Address warnings about accidental non-ASCII dashes in comments ( #355 )
2019-10-01 21:50:52 +02:00
Sebastian Pipping
24a912c12c
xmlparse.c|xmlrole.c: Fix compiler warning "unused parameter" with -DEXPAT_DTD=OFF
2019-09-29 19:34:39 +02:00
Sebastian Pipping
d05afa5829
xmlparse.c: Address compiler warninging with -DEXPAT_CONTEXT_BYTES=OFF
...
Warning was:
comparison of integers of different signs: 'int' and 'unsigned long'
2019-09-29 19:34:39 +02:00
Sebastian Pipping
25c96511a0
Bump version from 2.2.8 to 2.2.9
2019-09-25 21:22:30 +02:00
bungeman
c6de942020
Only define _CRT_RAND_S when not already defined.
...
There exist builds which go out of their way to define _CRT_RAND_S for everything by forcing it into the list of macros defined on the command line to the compiler. Unfortunately, something like "-D_CRT_RAND_S" implies _CRT_RAND_S is defined to be '1' and defining it to be empty produces a redefinition.
Since the intention here is to ensure that _CRT_RAND_S is always defined, only define it if it isn't already defined.
2019-09-18 10:39:05 -04:00
Sebastian Pipping
a5414b759d
Bump version from 2.2.7 to 2.2.8
2019-09-13 22:03:21 +02:00
Sebastian Pipping
6da1f19625
Merge pull request #318 from libexpat/issue-317
...
Deny internal entities closing the doctype (for #317 )
2019-09-03 22:00:41 +02:00
Sebastian Pipping
8735c77127
xmltok.c: Fix unused variables warnings for -DXML_MIN_SIZE
2019-09-01 16:07:56 +02:00
Sebastian Pipping
00dabedd00
expat_external.h: Inline remains of XML_USE_MSC_EXTENSIONS
2019-08-29 19:49:56 +02:00
Sebastian Pipping
36fa081cfe
Drop support for Visual Studio <=7.1/2003
...
_MSC_VER 1400 is 8.0/2005
2019-08-29 19:49:27 +02:00
Sebastian Pipping
71485dcf8b
win32: Remove MSVC solution and project files
2019-08-29 02:35:05 +02:00
Sebastian Pipping
c20b758c33
xmlparse.c: Deny internal entities closing the doctype
2019-08-28 15:14:26 +02:00
Sebastian Pipping
748ac8799d
xmltok: Add more in-code documentation about byte types
2019-08-28 01:27:32 +02:00
Sebastian Pipping
80d2829fa8
Merge branch 'david-loffredo-portable-unused-param-fix' ( #313 )
2019-08-17 18:20:49 +02:00
David Loffredo
561773607c
handle unused parameters with the usual (void)param; statement rather than gcc-specific attribute
...
Signed-off-by: David Loffredo <loffredo@steptools.com>
2019-08-16 09:52:09 -04:00
David Loffredo
9cb5c2c051
fix loss of data warnings with vc15 win64 and /W4
...
Signed-off-by: David Loffredo <loffredo@steptools.com>
2019-08-15 16:39:48 -04:00
Sebastian Pipping
8a935ff9ab
xmlparse.c: Mention rand_s with stdlib include
2019-08-07 19:50:50 +02:00
David Loffredo
5d34a708e7
replace loadlibrary.c and RtlGenRandom call with rand_s() on windows
...
Signed-off-by: David Loffredo <loffredo@steptools.com>
2019-08-07 19:43:38 +02:00
David Loffredo
c5a2867de1
Make win32 stdlib.h define rand_s(), add writeRandomBytes_rand_s().
...
Signed-off-by: David Loffredo <loffredo@steptools.com>
2019-08-07 19:42:16 +02:00
Sebastian Pipping
4007706509
xmlparse.c: Fix effect of XML_StopParser for end element handlers ( #240 )
2019-08-04 15:15:27 +02:00
clang-format
d248bbd940
Mass-apply clang-format 9 using ./apply-clang-format.sh
2019-08-03 21:31:44 +02:00
Sebastian Pipping
c951711d75
siphash.h: Prepare for application of clang-format
2019-08-03 21:31:44 +02:00
Sebastian Pipping
61b010bde6
xmltok_impl.c: Re-format use of LEAD_CASE macro
...
This will make clang-format 9 produce stable results.
2019-08-03 21:31:44 +02:00
Sebastian Pipping
c174c05433
expat.h: Drop OpenVMS support leftover ( #14 )
2019-07-28 17:58:56 +02:00
Sebastian Pipping
3053f53d34
xmlparse.c: Address Clang Static Analyzer false positive ( #295 )
2019-07-28 00:09:25 +02:00
Sebastian Pipping
21e11f7782
internal.h: Fix UNUSED_P for GCC 3.3 ( fixes #288 )
2019-07-20 16:42:21 +02:00
Sebastian Pipping
d4d8d486af
xmltok.c: Use memcpy instead of copying single bytes ( fixes #282 )
...
Fixes cppcheck's complaint as a side-effect.
2019-07-17 16:21:32 +02:00
Sebastian Pipping
0117f01906
xmlparse.c: Limit scope of new_connector to save sizeof(char*) on the stack
2019-07-01 20:15:11 +02:00
Sebastian Pipping
eef2b12935
xmlparse.c: Drop needless re-calculation of keep ( #268 )
...
Fixes variable shadowing as a side effect.
2019-06-29 22:41:54 +02:00