Commit graph

4038 commits

Author SHA1 Message Date
Sebastian Pipping
fb702e6c0e
Merge pull request #790 from libexpat/cmake-build-benchmark-also
CMake: Build `tests/benchmark/benchmark.c` for `EXPAT_BUILD_TESTS`
2023-11-22 13:04:23 +01:00
Sebastian Pipping
a55b7925b2 benchmark.c: Address MSVC warnings C4267 and C4244
Compiler output was:
> tests\benchmark\benchmark.c(102): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
> tests\benchmark\benchmark.c(117): warning C4244: 'initializing': conversion from '__int64' to 'int', possible loss of data
2023-11-21 21:42:50 +01:00
Sebastian Pipping
038040447e CMake: Build tests/benchmark/benchmark.c for EXPAT_BUILD_TESTS
.. like the Autotools build system does.
2023-11-21 20:27:24 +01:00
Sebastian Pipping
3588720613
Merge pull request #787 from libexpat/tests-more-chunk-size-coverage
tests: Migrate more tests to variable chunk size parsing
2023-11-13 15:21:37 +01:00
Sebastian Pipping
d2b31760cd tests: Simplify _XML_Parse_SINGLE_BYTES
Co-authored-by: Snild Dolkow <snild@sony.com>
2023-11-11 02:15:44 +01:00
Sebastian Pipping
3e5f6d6601 tests: Migrate more tests to variable chunk size parsing 2023-11-09 20:27:20 +01:00
Sebastian Pipping
795cf99922 tests: Make _XML_Parse_SINGLE_BYTES deny use with pathological input 2023-11-09 20:26:38 +01:00
Sebastian Pipping
df1e3d6f1e
Merge pull request #788 from SonyMobile/narrower-mingw-workaround
tests: Narrow test_buffer_can_grow_to_max mingw allocation workaround at compile time
2023-11-09 15:50:38 +01:00
Snild Dolkow
dcbc143680 tests: Narrow test_buffer_can_grow_to_max mingw allocation workaround
Instead of applying it to all less-than-64-bit platforms, let's narrow
the workaround to just the known failure: 32-bit mingw.
2023-11-09 10:46:51 +01:00
Sebastian Pipping
3a0c5d6ae5
Merge pull request #777 from libexpat/xml-dtd-undefined
Fix issues for compilation with XML_DTD undefined
2023-11-08 14:05:03 +01:00
Sebastian Pipping
d11ed9fa48
Merge pull request #786 from libexpat/tests-nan-and-infinity
tests: Use NAN and INFINITY of C99 and C++11
2023-11-07 16:37:38 +01:00
Sebastian Pipping
9411ac625b tests: Use NAN and INFINITY of C99 and C++11
Effectively reverts commit f6f5d9bb4c.
2023-11-07 14:22:31 +01:00
Sebastian Pipping
8a6c61de4a lib: Add XML_GE to XML_GetFeatureList and XML_FeatureEnum
Co-authored-by: Snild Dolkow <snild@sony.com>
2023-11-07 13:00:42 +01:00
clang-format
ac14808b26 Mass-apply clang-format 17.0.3 using ./apply-clang-format.sh 2023-11-07 13:00:42 +01:00
Sebastian Pipping
55fecd6aa4 Drop redundant "XML_GE == 1" guards
These are redundant because further out there is a guard
for "XML_GE == 1" already.  In the visual world, the pattern
is this:

> #if XML_GE == 1
> [..]
> #  if XML_GE == 1
> [..]
> #  endif
> [..]
> #endif

Spotted by Snild Dolkow, thanks!

Co-authored-by: Snild Dolkow <snild@sony.com>
2023-11-07 13:00:42 +01:00
Sebastian Pipping
caa2719863 Simplify "defined(XML_DTD) || XML_GE == 1" to "XML_GE == 1" 2023-11-07 13:00:42 +01:00
Sebastian Pipping
2848dc4e70 Simplify "! defined(XML_DTD) && XML_GE == 0" to "XML_GE == 0" 2023-11-07 13:00:42 +01:00
Sebastian Pipping
e3aaa06cdf linux.yml: Add a dedicated run for -DEXPAT_GE=OFF 2023-11-07 13:00:42 +01:00
Sebastian Pipping
d269f90975 coverage.sh: Cover XML_DTD undefined (with and without XML_GE) 2023-11-07 13:00:42 +01:00
Sebastian Pipping
cdead241d4 doc/reference.html: Clarify effect of XML_DTD on external entities
Defining XML_DTD emnables support for external parameter(!)
entities.  External general(!) entities have been supported
even with XML_DTD undefined.  (Only now with Expat 2.6.0
defining XML_GE as 0 can take that away.)
2023-11-07 13:00:42 +01:00
Sebastian Pipping
d3f7bbd37b doc/reference.html: Document build time macro XML_GE 2023-11-07 13:00:42 +01:00
Sebastian Pipping
2f18bacfcd tests: Cover and adjust to XML_GE==0 self-references 2023-11-07 13:00:42 +01:00
Sebastian Pipping
2b127c20b2 lib: Make XML_GE==0 use self-references as entity replacement text 2023-11-06 21:02:42 +01:00
Sebastian Pipping
7767efe1aa tests/handlers.c: Make accumulate_entity_decl robust towards value==NULL 2023-11-06 21:02:42 +01:00
Sebastian Pipping
b0975cb73a lib: Fail the build if XML_GE is not set to 1 or 0 2023-11-06 20:43:09 +01:00
Sebastian Pipping
00089ed745 tests: Fix tests for XML_GE==0 + broaden for XML_GE==1 2023-11-06 20:43:09 +01:00
Sebastian Pipping
0f075ec8ec lib|xmlwf|cmake: Extend scope of billion laughs attack protection
.. from "defined(XML_DTD)" to "defined(XML_DTD) || XML_GE==1".
2023-11-06 20:43:09 +01:00
Sebastian Pipping
ed87a47934 configure.ac: Define macro XML_GE as 1 2023-11-06 20:43:09 +01:00
Sebastian Pipping
daa89e42c0 cmake: Introduce option EXPAT_GE to control macro XML_GE 2023-11-06 20:43:09 +01:00
Sebastian Pipping
d285fafaca
Merge pull request #785 from libexpat/fix-dll-version-info
win32|cmake: Fix FileVersion and ProductVersion in DLL version info
2023-11-04 00:20:34 +01:00
Sebastian Pipping
781269f4a8 win32|cmake: Fix FileVersion and ProductVersion in DLL version info
Before: {'FileVersion': 'VER_FILEVERSION', 'ProductVersion': 'VER_FILEVERSION'}
After: {'FileVersion': '2.5.0.0', 'ProductVersion': '2.5.0.0'}

Thanks to @spookyahell for helpful gist "exe2version_info.py":
https://gist.github.com/spookyahell/b317bdf0712aac5fd37dd79f70bfbe69
2023-11-03 21:55:49 +01:00
Sebastian Pipping
d4e0eeb77b
Merge pull request #771 from SonyMobile/buffer-limit
Grow buffer based on current size
2023-10-26 15:53:18 +02:00
Snild Dolkow
119ae277ab Grow buffer based on current size
Until now, the buffer size to grow to has been calculated based on the
distance from the current parse position to the end of the buffer. This
means that the size of any already-parsed data was not considered,
leading to inconsistent buffer growth.

There was also a special case in XML_Parse() when XML_CONTEXT_BYTES was
zero, where the buffer size would be set to twice the incoming string
length. This patch replaces this with an XML_GetBuffer() call.

Growing the buffer based on its total size makes its growth consistent.

The commit includes a test that checks that we can reach the max buffer
size (usually INT_MAX/2 + 1) regardless of previously parsed content.

GitHub CI couldn't allocate the full 1GiB with MinGW/wine32, though it
works locally with the same compiler and wine version. As a workaround,
the test tries to malloc 1GiB, and reduces `maxbuf` to 512MiB in case
of failure.
2023-10-26 08:21:51 +02:00
Sebastian Pipping
adf413c56c
Merge pull request #784 from libexpat/tests-drop-unused-type
tests/handlers.h: Drop unused type XmlParseFunction
2023-10-26 00:26:15 +02:00
Sebastian Pipping
4a4e7cfae6 tests/handlers.h: Drop unused type XmlParseFunction
Last use removed in commit b3d14b0d3c
2023-10-25 22:08:04 +02:00
Sebastian Pipping
5347517942
Merge pull request #783 from SonyMobile/remove-singlebytes-switching
tests: Stop switching between XML_Parse and _XML_Parse_SINGLE_BYTES
2023-10-25 18:38:53 +02:00
Snild Dolkow
1222ae34fb tests: Use SINGLE_BYTES in test_nobom_utf16_le
All tests now run one instance where SINGLE_BYTES is equivalent to a
single XML_Parse call. Using SINGLE_BYTES therefore gives more coverage,
as evidenced by the new failure we now have to avoid in the test, until
it can be fixed.
2023-10-25 17:25:48 +02:00
Snild Dolkow
29babedcab tests: Remove EE_PARSE_FULL_BUFFER
All tests now run one instance where SINGLE_BYTES is equivalent to a
single XML_Parse call. There is no longer a need for individual tests
to switch between them.
2023-10-25 17:25:05 +02:00
Snild Dolkow
b3d14b0d3c tests: Remove choice between XML_Parse and SINGLE_BYTES
Since commit 091ba48d ("tests: Run SINGLE_BYTES with no chunking"),
all tests are run an extra time with SINGLE_BYTES set to perform just
a single XML_Parse() call. There is no longer a need for individual
tests to switch between them.
2023-10-25 17:25:00 +02:00
Sebastian Pipping
9e1c41343c
Merge pull request #780 from libexpat/xml-dtd-undefined-fix-ext-parser-create-null-dereference
xmlparse.c: Fix `NULL` pointer dereference in `setContext` via `XML_ExternalEntityParserCreate` for `XML_DTD` undefined
2023-10-24 17:05:31 +02:00
Sebastian Pipping
7b814b8220
Merge pull request #781 from libexpat/tests-move-to-the-right-place
tests/acc_tests.c: Move second BOM accounting test to the right place
2023-10-24 17:02:20 +02:00
Sebastian Pipping
258abf00fe
Merge pull request #782 from libexpat/tests-drop-mistaken-unused-variable-marker
tests/handlers.c: Drop mistaken unused variable marker
2023-10-24 17:01:35 +02:00
Sebastian Pipping
54f1c4595f tests/handlers.c: Drop mistaken unused variable marker 2023-10-23 21:18:04 +02:00
Sebastian Pipping
6e1ddc3b9c tests/acc_tests.c: Move second BOM accounting test to the right place
The test makes use of general entities (not parameter entities)
but was mis-filed under parameter entities.
2023-10-23 20:30:45 +02:00
Sebastian Pipping
4eeaf49262 xmlparse.c: Fix NULL pointer dereference in XML_ExternalEntityParserCreate
.. for context NULL inside function setContext
when macro XML_DTD is not defined at compile time.
2023-10-23 18:14:56 +02:00
Sebastian Pipping
a39a2f5c65
Merge pull request #779 from libexpat/doc-reference-html-add-macro-anchors
doc/reference.html: Add HTML anchors to definition of XML_* macros
2023-10-23 18:12:08 +02:00
Sebastian Pipping
7b0cf18e6f
Merge pull request #778 from libexpat/dependabot/github_actions/actions/checkout-4.1.1
Actions(deps): Bump actions/checkout from 4.1.0 to 4.1.1
2023-10-23 15:38:46 +02:00
Sebastian Pipping
76d60929c2 doc/reference.html: Add HTML anchors to definition of XML_* macros 2023-10-23 15:33:08 +02:00
Sebastian Pipping
a83a941898
Merge pull request #774 from libexpat/tests-rename-fail-unless
tests: Rename fail_unless to assert_true for clarity
2023-10-23 14:46:12 +02:00
dependabot[bot]
dcaa886004
Actions(deps): Bump actions/checkout from 4.1.0 to 4.1.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8ade135a41...b4ffde65f4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-23 12:20:43 +00:00