fuzz/fuzz.c


Log

Author Commit Date CI Message
Nick Wellnhofer df40f64e 2024-06-13T18:00:33 fuzz: Avoid accessing internal struct members Switch to xmlNewIOInputStream.
Nick Wellnhofer 52384043 2024-06-11T19:10:41 parser: Pass resource type to resource loader
Nick Wellnhofer 780e432a 2024-06-11T16:58:09 fuzz: Move to per-context error handler
Nick Wellnhofer 116d8c01 2024-06-11T15:48:32 fuzz: Move to per-context resource loader
Nick Wellnhofer caa8bb38 2024-05-19T19:31:54 fuzz: Move back to xmlSetExternalEntityLoader xmlParserInputBufferCreateFilenameDefault can't report malloc failures.
Nick Wellnhofer b3cb41be 2024-05-13T12:18:08 fuzz: Add xmllint fuzzer
Nick Wellnhofer 971ce404 2024-04-14T19:33:21 fuzz: Also set fuzzAllocFailed if a real allocation fails Avoid false positives in real OOM situations.
Nick Wellnhofer ee0c1f87 2024-02-29T14:51:49 fuzz: New tree API fuzzer
Nick Wellnhofer fd801845 2024-01-07T15:19:58 fuzz: Cap URL size Cap URL size to avoid quadratic behavior when generating error messages.
Nick Wellnhofer 54c70ed5 2023-12-18T19:31:29 parser: Improve error handling Introduce xmlCtxtSetErrorHandler allowing to set a structured error for a parser context. There already was the "serror" SAX handler but this always receives the parser context as argument. Start to use xmlRaiseMemoryError. Remove useless arguments from memory error functions. Rename xmlErrMemory to xmlCtxtErrMemory. Remove a few calls to xmlGenericError. Remove support for runtime entity debugging.
Nick Wellnhofer f19a9510 2023-12-10T17:50:22 parser: Report malloc failures Fix many places where malloc failures aren't reported. Make xmlErrMemory public. This is useful for custom external entity loaders. Introduce new API function xmlSwitchEncodingName. Change the way how we store whether the the parser is stopped. This used to be signaled by setting ctxt->instate to XML_PARSER_EOF which was misdesigned and error-prone. Set ctxt->disableSAX to 2 instead and introduce a macro PARSER_STOPPED. Also stop to remove parser inputs in xmlHaltParser. This allows to remove many checks of ctxt->instate. Introduce xmlErrParser to handle errors if a parser context is available.
Nick Wellnhofer da996c8d 2023-12-10T14:46:59 uri: Report malloc failures Fix many places where malloc failures weren't reported, for example after calling xmlStrdup. Introduce new public API functions that return a separate error code if a memory allocation fails: - xmlParseURISafe - xmlBuildURISafe - xmlBuildRelativeURISafe Update the fuzzer to check whether malloc failures are reported.
Nick Wellnhofer b7d56ef7 2023-09-22T17:03:56 malloc-fail: Report malloc failure in xmlRegEpxFromParse Also check whether malloc failures are reported when fuzzing.
Nick Wellnhofer 834b8123 2023-08-08T15:21:28 parser: Stream data when reading from memory Don't create a copy of the whole input buffer. Read the data chunk by chunk to save memory. Historically, it was probably envisioned to read data from memory without additional copying. This doesn't work reliably with the current design of the XML parser which requires a terminating null byte at the end of input buffers. This lead to xmlReadMemory interfaces, which expect pointer and size arguments, being changed to make a zero-terminated copy of the input buffer. Interfaces based on xmlReadDoc, which actually expect a zero-terminated string and would make zero-copy operation work, were then simplified to rely on xmlReadMemoryi, resulting in an unnecessary copy. To avoid copying (possibly gigabytes) of memory temporarily, we now stream in-memory input just like content read from files in a chunk-by-chunk fashion (using a somewhat outdated INPUT_CHUNK size of 250 bytes). As a side effect, we also avoid another copy of the whole input when handling non-UTF-8 data which was made possible by some earlier commits. Interfaces expecting zero-terminated strings now make use of strnlen which unfortunately isn't part of the standard C library and only mandated since POSIX 2008.
Nick Wellnhofer 42322eba 2023-03-08T13:59:03 fuzz: Inject random malloc failures Fixes #344.
Nick Wellnhofer 541b1e28 2023-03-08T13:59:00 fuzz: Support variable integer sizes in fuzz data Also switch to big-endian.
Nick Wellnhofer 791a1e80 2023-02-28T19:14:57 fuzz: Set filename in xmlFuzzEntityLoader
Nick Wellnhofer cbd9c6c5 2023-02-28T19:14:22 fuzz: Allow xmlFuzzReadString(NULL)
Nick Wellnhofer 128c0261 2022-10-25T19:23:07 warnings: Fix -Wstrict-prototypes warning
Nick Wellnhofer be889b65 2022-01-26T16:35:18 Make xmlFuzzReadString return a zero size in error case Avoids use of uninitialized memory.
Nick Wellnhofer e2b975c3 2020-12-18T00:50:34 Handle malloc failures in fuzzing code Avoid misdiagnosis in OOM situations.
Nick Wellnhofer 0d5f3710 2020-08-24T16:28:54 Consolidate seed corpus generation Implement file handling in C to speed up corpus generation.
Nick Wellnhofer 0d9da029 2020-08-24T03:16:25 Test fuzz targets with dummy driver Run fuzz targets with files in seed corpus during test.
Nick Wellnhofer ad26a60f 2020-08-06T13:20:01 Add XPath and XPointer fuzzer
Nick Wellnhofer eac1c7e2 2020-06-21T14:42:00 Fuzz target for XML Schemas This only tests the schema parser for now.
Nick Wellnhofer ffd31dbe 2020-06-21T12:14:19 Move entity recorder to fuzz.c
Nick Wellnhofer 536f421d 2020-06-15T12:20:54 Fuzz target for HTML parser
Nick Wellnhofer 00ed736e 2020-06-05T12:49:25 Add a couple of libFuzzer targets - XML fuzzer Currently tests the pull parser, push parser and reader, as well as serialization. Supports splitting fuzz data into multiple documents for things like external DTDs or entities. The seed corpus is built from parts of the test suite. - Regexp fuzzer Seed corpus was statically generated from test suite. - URI fuzzer Tests parsing and most other functions from uri.c.