Commit graph

1078 commits

Author SHA1 Message Date
Sebastian Pipping
9b672513c8 lib/xmlwf: Leverage xcslen 2025-03-28 23:45:19 +01:00
Sebastian Pipping
2b2a24691a Sync file headers 2025-03-27 17:45:25 +01:00
Sebastian Pipping
a6497c3004 Bump version to 2.7.1 2025-03-27 17:45:25 +01:00
Sebastian Pipping
c096f96980 tests: Cover m_eventPtr value with entities and reentering
m_eventPtr is a key provider to these functions:
- XML_GetCurrentByteCount
- XML_GetCurrentByteIndex
- XML_GetCurrentColumnNumber
- XML_GetCurrentLineNumber
- XML_GetInputContext
2025-03-25 18:31:41 +01:00
Sebastian Pipping
f3feb0d09c tests: Make strndup(3) available to C99 2025-03-25 18:31:41 +01:00
Sebastian Pipping
ac8a0e8f04 tests/benchmark: Resolve mistaken double close
From "man fdopen":
> The file descriptor is not dup'ed, and will be closed
> when the stream created by fdopen() is closed.
2025-03-15 01:38:13 +01:00
Sebastian Pipping
2ae4c8afd3 Sync file headers 2025-03-13 20:41:33 +01:00
Sebastian Pipping
0a6cbff62c Bump version to 2.7.0 2025-03-13 20:41:33 +01:00
Sebastian Pipping
bbd413a808 Sync file headers 2025-03-13 14:01:31 +01:00
Berkay Eren Ürün
eb53088cd5 tests: Cover missing elements after internal entity reference 2025-03-13 14:01:31 +01:00
Sebastian Pipping
d0e04b3b75 tests: Cover free'ing of all three open entity lists by XML_ParserReset
.. without taking away coverage from XML_ParserFree
2025-03-13 14:01:31 +01:00
Berkay Eren Ürün
66b695f150 Increase coverage for parameter entity refs in doProlog 2025-03-13 14:01:31 +01:00
Berkay Eren Ürün
e15cdd6c1f Add test case for nested entities with delayed interpretation 2025-03-13 14:01:31 +01:00
Berkay Eren Ürün
00fda3c598 Add test case for unbounded entity recursion in attributes 2025-03-13 14:01:31 +01:00
Sebastian Pipping
0ab49eafae tests: Cover suspend inside nested entites in internalEntityProcessor more 2025-03-13 14:01:31 +01:00
Sebastian Pipping
3679f63dab tests: Cover internalEntityProcessor reentering being finite
The new test asserts that internalEntityProcessor does not loop forever while
processing entities where external entity content references back to internal
entities from the parent document (see &e3; and &e4; below).
We ensure that progress is made after moving the parser from recursive
invocation to a state based processing within function callProcessor.

A version of this test case (originally external-to-Expat, "make run-xmltest")
failed earlier, so we wanted to have a variant of this test (that proved
itself relevant) included within the core test suite ("make check").
2025-03-13 14:01:31 +01:00
Sebastian Pipping
dae1cd5a1b tests: Add support for "CharData *storage" to ExtHdlrData
.. for an upcoming test in a follow-up commit
2025-03-13 14:01:31 +01:00
Berkay Eren Ürün
ad9e140612 Add test cases for unbounded entity recursion 2025-03-13 14:01:31 +01:00
Hanno Böck
87fb1a42f0 Update links in code comments to https 2025-03-07 08:42:42 +01:00
Sebastian Pipping
ba7853edef tests: Address Cppcheck 2.17.1 warning about malloc returning NULL 2025-03-07 03:06:24 +01:00
Sebastian Pipping
6620f6f40a tests/minicheck: Use more portable check for __attribute__((noreturn))
Related:
https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html
2025-03-07 03:06:21 +01:00
Sebastian Pipping
401e6d4f49 tests/benchmark: Address Cppcheck 2.17.1 warning about malloc returning NULL 2025-03-07 03:06:18 +01:00
Sebastian Pipping
7f5903483e tests/benchmark: Make error messages more technical 2025-02-21 23:31:32 +01:00
Sebastian Pipping
ead919d692 tests/benchmark: Resolve (harmless) TOCTTOU
.. that was reported by Coverity Scan.

https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use
2025-02-21 23:31:32 +01:00
Sebastian Pipping
5f4144a6bc tests/benchmark: Add missing call to fclose 2025-02-21 23:31:23 +01:00
Sebastian Pipping
4de3d65003 tests/benchmark: Resolve needless use of exit for clarity 2025-02-21 22:24:16 +01:00
Sebastian Pipping
524096c139 tests/benchmark: Rename misleading variable "fd" to "file" 2025-02-21 22:19:26 +01:00
Sebastian Pipping
de96ce5b5d tests: Cover doContent with startTagLevel >=2 2024-12-11 12:29:32 +01:00
Sebastian Pipping
e58a3c9645 tests: Cover case 0xff for unsignedCharToPrintable 2024-12-09 23:34:08 +01:00
Sebastian Pipping
3d5fdbb44e tests: Cover indirect entity recursion 2024-11-26 18:29:36 +01:00
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
750c985f11 Sync file headers 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
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
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
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
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
f9cfbb7fce Sync file headers 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