Commit graph

3737 commits

Author SHA1 Message Date
Sebastian Pipping
885f4c6303 tests: Save some runtime in test_misc_deny_internal_entity_closing_doctype_issue_317
Idea by Sebastian Andrzej Siewior
2024-11-23 15:34:49 +01:00
Sebastian Pipping
7b05b1420b tests: Make suspend_after_element_declaration check for XML_StopParser success
Idea by Sebastian Andrzej Siewior
2024-11-23 15:34:49 +01:00
Sebastian Pipping
f46a225dc4 tests: Cover doctype closing for internalEntityProcessor through suspension 2024-11-23 15:34:43 +01:00
Sebastian Pipping
31cb5b01fa tests: Protect against accidental misuse of single-bytes approach
Please see commit 60dffa148c
("tests: Use normal XML_Parse in test_suspend_resume_internal_entity")
for more details on the related issue.

In reaction to analysis by Berkay Eren Ürün.
2024-11-23 12:50:55 +01:00
Sebastian Pipping
c33ff57a51 tests: Save runtime on tests that do not use the single-bytes approach
Related tests are:
- test_reset_in_entity
- test_resume_entity_with_syntax_error
- test_suspend_parser_between_cdata_calls
2024-11-23 12:50:55 +01:00
Sebastian Pipping
35ec6e65d6 tests: Fix multiple places that combined single-bytes with suspension
Please see commit 60dffa148c
("tests: Use normal XML_Parse in test_suspend_resume_internal_entity")
for more details on the related issue.

Related tests are:
- test_repeated_stop_parser_between_char_data_calls
- test_reset_in_entity
- test_resume_entity_with_syntax_error
- test_suspend_parser_between_cdata_calls
- test_suspend_parser_between_char_data_calls
- test_suspend_xdecl

In reaction to a finding by Berkay Eren Ürün.
2024-11-23 12:50:55 +01:00
Sebastian Pipping
3d317c9564 autotools: Sync CMake templates with CMake 3.29 2024-11-15 23:20:19 +01:00
Sebastian Pipping
9d17a3a073 doc: Add missing documentation of error XML_ERROR_NOT_STARTED 2024-11-09 19:20:58 +01:00
Sebastian Pipping
750c985f11 Sync file headers 2024-11-06 17:42:20 +01:00
Sebastian Pipping
b5b5031516 Set release date for 2.6.4 2024-11-06 17:42:20 +01:00
Sebastian Pipping
c15ac3b307 Bump version to 2.6.4 2024-11-06 17:42:20 +01:00
Sebastian Pipping
ad7b7cbe6b Bump version info from 10:3:9 to 11:0:10
See https://verbump.de/ for what these numbers do
2024-11-06 17:42:20 +01:00
Sebastian Pipping
a5725d8207 Changes: Document changes in release Expat 2.6.4 2024-11-06 17:42:20 +01:00
clang-format 19.1.2
e971e2ed1a tests: Re-format test_misc_deny_internal_entity_closing_doctype_issue_317 2024-11-05 00:32:29 +01:00
Sebastian Pipping
20580a4550 tests: Improve test_misc_deny_internal_entity_closing_doctype_issue_317 case 3
"%e;" resolves to "]><d" which needs additional "/>" to make the
wanted "]><d/>", eventually.
2024-11-05 00:31:38 +01:00
Sebastian Pipping
80c2512d71 tests: Fix test_misc_deny_internal_entity_closing_doctype_issue_317 case 2
"&#37;e1;" resolves to "%e1;" which resolves to "]><d/>".
Now with c20b758c33 reverted, test case
"inputTwo" has an actual chance of being a false positive parse.
2024-11-05 00:19:00 +01:00
Sebastian Pipping
ef485e96a6
Merge pull request #915 from libexpat/stop-resumeparser-from-crashing
[CVE-2024-50602] Stop `XML_ResumeParser` from crashing
2024-10-28 15:14:02 +01:00
Hanno Böck
d827287012 Cast enum vars to unsigned int if used in printf
It is not specified by the C standard whether enum is unsigned,
therefore, make sure it is always unsigned if we print it as a
number.
2024-10-23 17:02:31 +02:00
Sebastian Pipping
b3836ff534 tests: Cover XML_StopParser's new handling of status XML_INITIALIZED
Prior to the fix to XML_StopParser, test test_misc_resumeparser_not_crashing
would crash with a NULL pointer dereference in function normal_updatePosition.
This was the AddressSanitizer output:

> AddressSanitizer:DEADLYSIGNAL
> =================================================================
> ==19700==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x5623e07ad85f bp 0x7ffcf40da650 sp 0x7ffcf40da590 T0)
> ==19700==The signal is caused by a READ memory access.
> ==19700==Hint: address points to the zero page.
>     #0 0x5623e07ad85f in normal_updatePosition [..]/lib/xmltok_impl.c:1781:13
>     #1 0x5623e07a52ff in initUpdatePosition [..]/lib/xmltok.c:1031:3
>     #2 0x5623e0762760 in XML_ResumeParser [..]/lib/xmlparse.c:2297:3
>     #3 0x5623e074f7c1 in test_misc_resumeparser_not_crashing() misc_tests_cxx.cpp
>     #4 0x5623e074e228 in srunner_run_all ([..]/build_asan_fuzzers/tests/runtests_cxx+0x136228)
>     #5 0x5623e0753d2d in main ([..]/build_asan_fuzzers/tests/runtests_cxx+0x13bd2d)
>     #6 0x7f802a39af79  (/lib64/libc.so.6+0x25f79)
>     #7 0x7f802a39b034 in __libc_start_main (/lib64/libc.so.6+0x26034)
>     #8 0x5623e064f340 in _start ([..]/build_asan_fuzzers/tests/runtests_cxx+0x37340)
>
> AddressSanitizer can not provide additional info.
> SUMMARY: AddressSanitizer: SEGV [..]/lib/xmltok_impl.c:1781:13 in normal_updatePosition
> ==19700==ABORTING

And this the UndefinedBehaviorSanitizer output:

> [..]/lib/xmltok_impl.c:1781:13: runtime error: load of null pointer of type 'const char'
> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior [..]/lib/xmltok_impl.c:1781:13 in
2024-10-21 18:27:46 +02:00
Sebastian Pipping
5fb89e7b3a lib: Be explicit about XML_PARSING in XML_StopParser 2024-10-21 18:27:46 +02:00
Sebastian Pipping
51c7019069 lib: Make XML_StopParser refuse to stop/suspend an unstarted parser 2024-10-21 18:27:46 +02:00
Hanno Böck
424dd12400 Fix signedness of format strings
Format strings used %d to print variables with unsigned values.
Changing to %u to match signedness.
Fixes "clang -Wformat-signedness" warnings.
2024-10-20 08:45:59 +02:00
Sebastian Pipping
038a0bf44f
Merge pull request #903 from Vollstrecker/patch-1
Add alias expat::expat
2024-10-05 21:41:06 +02:00
Sebastian Pipping
75b550dc70 README.md: Document use of Expat via CMake >=3.18 with FetchContent
.. and SOURCE_SUBDIR
2024-10-05 16:44:48 +02:00
Sebastian Pipping
cfe35b96ef tests: Extract constant "storage" in function accumulate_characters
.. to avoid potential reader confusion about where the input character
data is coming from: variable "storage" says that more clearly
and is consistent with multiple other places in the test suite.
2024-09-27 00:01:37 +02:00
Sebastian Pipping
c46543e053 tests: Add "const" in two places 2024-09-27 00:01:37 +02:00
Sebastian Pipping
4d2e3b5f38 tests: Move last remaining handlers from common.{c,h} to handlers.{c,h} 2024-09-27 00:01:37 +02:00
Sebastian Pipping
fe9251de69 tests: Resolve duplicate handler accumulate_char_data
Handler accumulate_characters does the exact same thing
and is used many times more throughout the test suite.
2024-09-27 00:01:28 +02:00
Vollstrecker
cd8904c072
Add alias expat::expat
As the find module and the config create the expat::expat alias for expat, the build-process should do this also to make it easier to include this in a chainbuild
2024-09-26 19:37:43 +02:00
Sebastian Pipping
f001f38aed tests: Migrate test_attributes off of g_parser 2024-09-21 21:57:31 +02:00
Sebastian Pipping
1968906b22 tests: Stop counting_start_element_handler from using g_parser
Use of g_parser means risk of cross-test interference
and hence risk of hard-to-catch bugs in the test suite,
and so we want to get rid of g_parser altogether midterm.
2024-09-21 21:57:31 +02:00
Sebastian Pipping
57fc7b1379 .gitignore: Add missing example "element_declarations" 2024-09-05 15:00:02 +02:00
Sebastian Pipping
f9cfbb7fce Sync file headers 2024-09-03 18:19:25 +02:00
Sebastian Pipping
156d4bab9d Set release date for 2.6.3 2024-09-03 18:19:25 +02:00
Sebastian Pipping
8707e02e1f Bump version to 2.6.3 2024-09-03 18:19:25 +02:00
Sebastian Pipping
93e5971fb5 Bump version info from 10:2:9 to 10:3:9
See https://verbump.de/ for what these numbers do
2024-09-03 18:19:25 +02:00
Sebastian Pipping
71e487dc1b Changes: Document changes in release Expat 2.6.3 2024-09-03 18:19:25 +02:00
Sebastian Pipping
29ef43a0ba
Merge pull request #892 from libexpat/taiyou-nextscaffoldpart-overflow
[CVE-2024-45492] lib: Detect integer overflow in function `nextScaffoldPart` (fixes #889)
2024-09-03 18:18:03 +02:00
Sebastian Pipping
b8a7dca467
Merge pull request #891 from libexpat/taiyou-dtdcopy-malloc-overflow
[CVE-2024-45491] lib: Detect integer overflow in `dtdCopy` (fixes #888)
2024-09-03 18:17:46 +02:00
Sebastian Pipping
e5d6bf015e
Merge pull request #890 from libexpat/taiyou-xml-parsebuffer-len
[CVE-2024-45490] lib: Reject negative len for `XML_ParseBuffer` (fixes #887)
2024-09-03 18:17:32 +02:00
Sebastian Pipping
8e439a9947 lib: Detect integer overflow in dtdCopy
Reported by TaiYou
2024-08-26 22:35:54 +02:00
Sebastian Pipping
2db233019f doc: Document that XML_Parse/XML_ParseBuffer reject "len < 0" 2024-08-26 22:25:19 +02:00
Sebastian Pipping
c12f039b80 tests: Cover "len < 0" for both XML_Parse and XML_ParseBuffer 2024-08-26 22:25:19 +02:00
Sebastian Pipping
5c1a31642e lib: Reject negative len for XML_ParseBuffer
Reported by TaiYou
2024-08-26 22:25:19 +02:00
Sebastian Pipping
9bf0f2c16e lib: Detect integer overflow in function nextScaffoldPart
Reported by TaiYou
2024-08-26 22:25:15 +02:00
Berkay Eren Ürün
c158a62e57 Remove XML_DTD guards before is_param accesses
As a part of the ENTITY struct, is_param is correctly initialized even
when XML_DTD is not defined. This can be seen in the 'lookup' function,
which sets all the ENTITY memory, including the is_param flag, to zero
during the ENTITY creation. Additionally, is_param can only be assigned
XML_TRUE when XML_DTD is defined, which makes XML_DTD checks before
is_param accesses not necessary.

Currently, some of the is_param accesses are guarded by the XML_DTD and
some not. This commit removes all XML_DTD guards that are meant for
is_param accesses.
2024-08-22 13:38:04 +02:00
Sebastian Pipping
35753a8ccc lib: Fix typo in a code comment 2024-08-20 21:16:57 +02:00
Sebastian Pipping
e19e52331b README.md: Promote call for help in the Changes file
Documentation on the used Markdown extension:
- https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
- https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts
2024-07-13 18:08:15 +02:00
Sebastian Pipping
09f8eddd8e autotools: Sync CMake templates with CMake 3.28 2024-07-13 00:13:25 +02:00
Sebastian Pipping
b0e673830e lib/siphash.h: Apply clang-format 18.1.5 2024-05-13 22:00:56 +02:00