Commit graph

33 commits

Author SHA1 Message Date
Sebastian Pipping
57a7643252 fuzz: Address clang-tidy bugprone-narrowing-conversions
The symptom was:
> [..]/expat/fuzz/xml_parse_fuzzer.c:68:40: error: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    68 |   XML_Parse(p, (const XML_Char *)data, size, 0);
>       |                                        ^
> [..]/expat/fuzz/xml_parse_fuzzer.c:69:44: error: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    69 |   if (XML_Parse(p, (const XML_Char *)data, size, 1) == XML_STATUS_ERROR) {
>       |                                            ^
> [..]/expat/fuzz/xml_parsebuffer_fuzzer.c:69:32: error: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    69 |   void *buf = XML_GetBuffer(p, size);
>       |                                ^
> [..]/expat/fuzz/xml_parsebuffer_fuzzer.c:72:22: error: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    72 |   XML_ParseBuffer(p, size, 0);
>       |                      ^
> [..]/expat/fuzz/xml_parsebuffer_fuzzer.c:73:26: error: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    73 |   buf = XML_GetBuffer(p, size);
>       |                          ^
> [..]/expat/fuzz/xml_parsebuffer_fuzzer.c:78:26: error: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
>    78 |   if (XML_ParseBuffer(p, size, 1) == XML_STATUS_ERROR) {
>       |                          ^
2025-03-30 18:52:09 +02:00
Hanno Böck
87fb1a42f0 Update links in code comments to https 2025-03-07 08:42:42 +01:00
Sebastian Pipping
a0b8957db2 Sync file headers 2025-02-03 01:37:51 +01:00
Sebastian Pipping
c18e90f927 xml_lpm_fuzzer: Use common attribution format 2025-02-03 01:36:22 +01:00
Sebastian Pipping
2a615bc3c5 xml_lpm_fuzzer: Unstuck MallocHook and ReallocHook
.. so that they fail single allocations, not all
allocations after a certain point.  Previously
fail_allocations of [6, 2, 20] worked the same way
fail_allocations of [2], likely by accidently.
2025-02-03 01:23:41 +01:00
clang-format 19.1.2
922e95a393 xml_lpm_fuzzer: Apply clang-format 19.1.2 2025-02-02 22:19:06 +01:00
Sebastian Pipping
b223d302cb xml_lpm_fuzzer: Address warning -Wunused-parameter 2025-02-02 22:19:06 +01:00
Sebastian Pipping
15b1af6716 xml_lpm_fuzzer: Address warning -Wsign-compare
Symptom was:
> [..]/expat/fuzz/xml_lpm_fuzzer.cpp:157:25: error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
>   157 |       for (int i = 0; i < content->numchildren; ++i) {
>       |                       ~ ^ ~~~~~~~~~~~~~~~~~~~~
> [..]/expat/fuzz/xml_lpm_fuzzer.cpp:183:25: error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
>   183 |       for (int i = 0; i < content->numchildren; ++i) {
>       |                       ~ ^ ~~~~~~~~~~~~~~~~~~~~
> [..]/expat/fuzz/xml_lpm_fuzzer.cpp:413:24: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
>   413 |   for (size_t i = 0; i < testcase.fail_allocations_size(); ++i) {
>       |                      ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> [..]/expat/fuzz/xml_lpm_fuzzer.cpp:421:24: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
>   421 |   for (size_t i = 0; i < testcase.actions_size(); ++i) {
>       |                      ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~
2025-02-02 22:19:06 +01:00
Sebastian Pipping
ea98a87971 xml_lpm_fuzzer: Add trailing newline 2025-02-02 22:19:06 +01:00
Sebastian Pipping
ea492aa54d xml_lpm_fuzzer: Add missing call to InitializeParser after XML_ParserReset 2025-02-02 22:19:06 +01:00
Sebastian Pipping
6933ee68f1 xml_lpm_fuzzer: Resolve dead code 2025-02-02 22:19:06 +01:00
Sebastian Pipping
d7736d9cfa xml_lpm_fuzzer: Resolve unused function parameter 2025-02-02 22:19:06 +01:00
Sebastian Pipping
4962f317d2 xml_lpm_fuzzer: Rename function to better match its nature 2025-02-02 22:19:06 +01:00
Sebastian Pipping
e183cb9811 xml_lpm_fuzzer: Be more thorough in model validation 2025-02-02 22:19:06 +01:00
Sebastian Pipping
5f42436e02 xml_lpm_fuzzer: Fix mistaken use of XML_Char 2025-02-02 22:19:06 +01:00
Sebastian Pipping
da8219b9af xml_lpm_fuzzer: Mark variable "fail_allocations" as global 2025-02-02 22:19:05 +01:00
Sebastian Pipping
2bb8a29428 xml_lpm_fuzzer: Mark variable "allocation_count" as global 2025-02-02 22:19:05 +01:00
Sebastian Pipping
59771b8f7f xml_lpm_fuzzer: Mark variables external_entity{,_size} as global 2025-02-02 22:19:05 +01:00
Sebastian Pipping
2b73e1bc00 xml_lpm_fuzzer: Mark variable "encoding" as global
This resolves variable shadowing in a few places also,
e.g. in XmlDeclHandler and UnknownEncodingHandler.
2025-02-02 22:19:05 +01:00
Sebastian Pipping
2ca8b39167 xml_lpm_fuzzer: Protect assert(...) from NDEBUG 2025-02-02 22:19:05 +01:00
Sebastian Pipping
8fec1ea699 Merge remote-tracking branch 'c01db33f/fuzzer' into pull-617-finish 2025-02-02 22:17:44 +01:00
Sebastian Pipping
5b70d3ac44 fuzz/xml_parsebuffer_fuzzer.c: Be more robust towards ouf-of-memory 2024-01-17 10:08:42 +01:00
Philippe Antoine
34af886238 fuzz: improve coverage by maybe stopping parser 2024-01-16 11:08:44 +01:00
Sebastian Pipping
73ebe0bfb3 fuzz: Address warning -Wunused-function with regard to sip24_valid 2024-01-15 23:57:02 +01:00
Philippe Antoine
bb58abd4e0 fuzz: improve coverage 2024-01-10 22:06:37 +01:00
t-0
0a0418faf8
File expat/fuzz/.gitignore changed to not ignore already-committed source files (fixes #630) (#631) 2022-08-20 23:37:46 +02:00
Mark Brand
02a6f9b25a fuzzers: Add support for failing allocations. 2022-07-22 15:39:19 +02:00
Mark Brand
1a4cbd495a fuzzers: Add a new libprotobuf-mutator fuzzer.
This fuzzer provides significantly higher coverage of the library, as
it implements more handlers and supports parser suspend/resume/reset
and external entity parsing.
2022-07-22 15:39:07 +02:00
Sebastian Pipping
0e567d2ed1 fuzzers: Address Clang warning -Wunused-parameter 2021-03-10 16:21:00 +01:00
Bhargava Shastry
8889179071 parsebuffer fuzzer: Bail out on empty fuzzer input 2019-11-17 21:12:13 +01:00
luz.paz
56893d4fbb Fix source comment typos
Found via `codespell -q 3 -S ./testdata,./expat/Changes`
2019-11-04 07:52:31 -05:00
Sebastian Pipping
ed04ca06fb fuzz: Add .gitignore 2019-08-29 17:25:46 +02:00
Mitch Phillips
29eddcae5f Add XML fuzzers to libexpat upstream. (#308) 2019-08-28 12:57:57 +02:00