Commit graph

22 commits

Author SHA1 Message Date
Sebastian Pipping
5b9e8dc70c
portable_strndup() must not read source string beyond NUL byte.
POSIX strndup() does not read memory beyond NUL byte of the source
string.  Preserve this behavior in libexpat implementation to prevent
access violations and keep portability.
2025-03-30 18:06:32 +02:00
Sebastian Pipping
2b2a24691a Sync file headers 2025-03-27 17:45:25 +01:00
Sebastian Pipping
f3feb0d09c tests: Make strndup(3) available to C99 2025-03-25 18:31:41 +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
750c985f11 Sync file headers 2024-11-06 17:42:20 +01: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
2a10e173ab Sync file headers 2024-02-06 14:13:00 +01:00
Snild Dolkow
182bbc350e tests: Make it clear to clang-tidy that assert_true may not return
The key is to have __attribute__((noreturn)) somewhere that clang-tidy
can see it. In this case, this is the _fail() function, which is
conditionally called from the assert_true() macro.

This will ensure that clang-tidy doesn't complain about NULL values
that we've asserted against in tests.
2024-01-29 19:57:54 +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
795cf99922 tests: Make _XML_Parse_SINGLE_BYTES deny use with pathological input 2023-11-09 20:26:38 +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
cce19de59f tests: Rename _fail_unless to _assert_true for clarity 2023-10-20 23:24:46 +02:00
Snild Dolkow
1d8ceb26aa tests: Run SINGLE_BYTES with variously-sized chunks
The _XML_Parse_SINGLE_BYTES function currently calls XML_Parse() one
byte at a time. This is useful to detect possible parsing bugs related
to having to exit parsing, wait for more data, and resume.

This commit makes SINGLE_BYTES even more useful by repeating all tests,
changing the chunk size every time. So instead of just one byte at a
time, we now also test two bytes at a time, and so on. Tests that don't
use the SINGLE_BYTES also run multiple times, but are otherwise not
affected.

This uncovered some issues, which have been fixed in preceding commits.

On failure, the chunk size is included in the "FAIL" log prints.
2023-09-25 14:01:53 +02:00
Donghee Na
e52b6b8b8c Update legal name of Donghee Na (#754) 2023-09-24 18:13:03 +02:00
Rhodri James
e70f9b2d5b Move the fail-on-command allocators to tests/common.c
Also make the control variables int rather than intptr_t.  They
were previously typed for convenience of passing them as a user
data "pointer", but that's much less convenient when they are
externally linked.
2022-10-31 13:14:46 +00:00
Rhodri James
bf11ca9025 Move (some) XML_GetBuffer tests out of runtests.c 2022-10-28 20:00:24 +01:00
Rhodri James
29115b5a83 Move more constant data out of runtests.c 2022-10-28 17:48:29 +01:00
Rhodri James
44f595931c Move parser_stop_character_handler out of runtests.c
Also make "abortable" a global and rename it g_abortable.
2022-10-28 17:43:50 +01:00
Rhodri James
a66d239d11 Move clearing_aborting_character_handler out of runtests.c
Also make "resumable" a global and rename it as g_resumable.
2022-10-28 17:34:55 +01:00
Rhodri James
9c4efa8cfd Move constant test data to common.c 2022-10-28 16:32:10 +01:00
Rhodri James
8a2b58b823 Move character and attribute data support functions to common.c 2022-10-28 15:02:26 +01:00
Rhodri James
f555f08853 Move common test support functions to a separate file.
A necessary first step if we are going to be able to reduce the
size of runtests.c by splitting test cases into separate files.
2022-10-28 13:15:58 +01:00