Commit graph

4015 commits

Author SHA1 Message Date
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
Sebastian Pipping
2604c59eb9
Merge pull request #773 from libexpat/clang-17
Upgrade Clang from 15 to 17
2023-10-21 15:52:09 +02:00
Sebastian Pipping
cf2a57bbe6 linux.yml: Make note about .ci.sh harder to overlook 2023-10-20 23:58:13 +02:00
Sebastian Pipping
e07ee1ec32 Actions: Upgrade Clang from 15 to 17 2023-10-20 23:58:13 +02:00
clang-format
a392427d3a Mass-apply clang-format 17.0.3 using ./apply-clang-format.sh 2023-10-20 23:49:51 +02:00
Sebastian Pipping
0cfeab4f1c
Merge pull request #772 from libexpat/tests-warnings-mingw
tests/memcheck.c: Avoid false positive -Wuse-after-free
2023-10-20 23:49:06 +02:00
Sebastian Pipping
da64791736 tests: Rename fail_unless to assert_true for clarity 2023-10-20 23:41:04 +02:00
Sebastian Pipping
cce19de59f tests: Rename _fail_unless to _assert_true for clarity 2023-10-20 23:24:46 +02:00
Sebastian Pipping
eeab6366b0 tests/memcheck.c: Avoid false positive -Wuse-after-free
Symptom was this compile warning from MinGW GCC 12:
> [..]/expat/tests/memcheck.c: In function ‘tracking_realloc’:
> [..]/expat/tests/memcheck.c:169:25: error: pointer ‘ptr’ may be used after ‘realloc’ [-Werror=use-after-free]
>   169 |       entry->allocation = ptr;
>       |       ~~~~~~~~~~~~~~~~~~^~~~~
> [..]/expat/tests/memcheck.c:166:25: note: call to ‘realloc’ here
>   166 |     entry->allocation = realloc(ptr, size);
>       |                         ^~~~~~~~~~~~~~~~~~

The warning is a false positive since the code was only using ptr
when realloc failed where it is documented that the original pointer is
not freed.

The workaround is to no longer override-and-restore entry->allocation
but to only write to it when realloc was successful.  The original
value was equal to ptr so the result is the same.
2023-10-20 20:19:37 +02:00
Sebastian Pipping
a68399a05b
Merge pull request #770 from libexpat/xmlwf-sync-man-page
xmlwf: Get man page back in sync (i.e. add `--help`, `--version` and `-g <bytes>`)
2023-10-18 21:46:41 +02:00
Sebastian Pipping
4d475d97d6 doc/xmlwf.xml: Add missing entry on "-g <bytes>" 2023-10-18 16:48:03 +02:00
Sebastian Pipping
1746075001 doc/xmlwf.xml: Add missing entry on -h|--help 2023-10-18 16:48:03 +02:00
Sebastian Pipping
114cb042ae doc/xmlwf.xml: Add --help and --version where missing 2023-10-18 16:48:03 +02:00
Sebastian Pipping
28347d9586
Merge pull request #764 from libexpat/xml-context-bytes-zero
Be stricter about macro XML_CONTEXT_BYTES at build time
2023-10-06 14:21:36 +02:00
Sebastian Pipping
96985a1a07 lib/xmlparse.c: Make clang-format 16.0.6 happy again 2023-10-05 15:44:10 +02:00
Sebastian Pipping
23110a864d Be stricter about macro XML_CONTEXT_BYTES
- Start treating -DXML_CONTEXT_BYTES=0 as "no context"
  rather than "context of size 0".  Was documented as
  "must be set to a positive integer", previously.

- Enforce that macro XML_CONTEXT_BYTES is defined at build time to
  avoid accidental misbuilds lacking context in environments that
  bypass both of Expats official build systems.

- Detect and reject use of negative context size at compile time.
2023-10-05 15:44:10 +02:00
Sebastian Pipping
acbcd0915d
Merge pull request #766 from libexpat/doc-parse-buffer-variables
lib/xmlparse.c: Improve parse buffer variables documentation
2023-10-05 14:50:10 +02:00
Sebastian Pipping
32f64cf174
Merge pull request #762 from libexpat/doc-reference-html-promote-xml-parsebuffer-more
doc/reference.html: Promote function XML_ParseBuffer more
2023-10-05 14:49:29 +02:00
Sebastian Pipping
3ae5431d22
Merge pull request #765 from libexpat/consistent-expat-config-h-includes
Make inclusion to expat_config.h consistent
2023-10-05 01:35:26 +02:00
Sebastian Pipping
dd34d0e65c lib/xmlparse.c: Improve parse buffer variables documentation 2023-10-04 22:40:31 +02:00
Sebastian Pipping
ab43d8d116 Make inclusion to expat_config.h consistent
.. and priorize the local build over the system header.
2023-10-04 19:58:28 +02:00
Sebastian Pipping
1d3ee5133e doc/reference.html: Make XML_Parse promote XML_ParseBuffer 2023-10-04 18:01:31 +02:00
Sebastian Pipping
81a705b6ae doc/reference.html: Wrap paragraphs by <p> for function XML_Parse 2023-10-03 23:25:09 +02:00
Sebastian Pipping
60654a3255
Merge pull request #763 from libexpat/fix-codespell-ci
Fix codespell CI + mass-replace "re-use[d]" by "reuse[d]"
2023-10-03 23:23:29 +02:00