1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00
libxml2/fuzz
Nick Wellnhofer 93ce33c2b8 Fix several quadratic runtime issues in HTML push parser
Fix a few remaining cases where the HTML push parser would scan more
content during lookahead than being parsed later.

Make sure that htmlParseDocTypeDecl consumes all content up to the
final '>' in case of errors. The old comment said "We shouldn't try to
resynchronize", but ignoring invalid content is also what the HTML5
spec mandates.

Likewise, make htmlParseEndTag skip to the final '>' in invalid end
tags even if not in recovery mode. This is probably the most visible
change in practice and leads to different output for some tests but is
also more in line with HTML5.

Make sure that htmlParsePI and htmlParseComment don't abort if invalid
characters are encountered but log an error and ignore the character.

Change some other end-of-buffer checks to test for a zero byte instead
of relying on IS_CHAR.

Fix usage of IS_CHAR macro in htmlParseScript.
2020-07-23 20:47:35 +02:00
..
seed Add a couple of libFuzzer targets 2020-06-05 13:53:11 +02:00
.gitignore Fuzz target for XML Schemas 2020-06-23 16:20:27 +02:00
fuzz.c Fuzz target for XML Schemas 2020-06-23 16:20:27 +02:00
fuzz.h Fuzz target for XML Schemas 2020-06-23 16:20:27 +02:00
html.c Fuzz target for HTML parser 2020-06-15 15:23:38 +02:00
html.dict Fix several quadratic runtime issues in HTML push parser 2020-07-23 20:47:35 +02:00
html.options Fuzz target for HTML parser 2020-06-15 15:23:38 +02:00
Makefile.am Fuzz target for XML Schemas 2020-06-23 16:20:27 +02:00
README Add a couple of libFuzzer targets 2020-06-05 13:53:11 +02:00
regexp.c Add a couple of libFuzzer targets 2020-06-05 13:53:11 +02:00
regexp.dict Add a couple of libFuzzer targets 2020-06-05 13:53:11 +02:00
schema.c Fuzz target for XML Schemas 2020-06-23 16:20:27 +02:00
schema.dict Fuzz target for XML Schemas 2020-06-23 16:20:27 +02:00
schema.options Fuzz target for XML Schemas 2020-06-23 16:20:27 +02:00
schemaSeed.c Fuzz target for XML Schemas 2020-06-23 16:20:27 +02:00
testFuzzer.c Add a couple of libFuzzer targets 2020-06-05 13:53:11 +02:00
uri.c Add a couple of libFuzzer targets 2020-06-05 13:53:11 +02:00
xml.c Add a couple of libFuzzer targets 2020-06-05 13:53:11 +02:00
xml.dict Add a couple of libFuzzer targets 2020-06-05 13:53:11 +02:00
xml.options Add options file for xml fuzzer 2020-06-09 13:53:06 +02:00
xmlSeed.c Fuzz target for XML Schemas 2020-06-23 16:20:27 +02:00

libFuzzer instructions for libxml2
==================================

Set compiler and options:

    export CC=clang
    export CFLAGS="-g -fsanitize=fuzzer-no-link,address,undefined \
        -fno-sanitize-recover=all \
        -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"

Build libxml2 with instrumentation:

    ./configure --without-python
    make

Run fuzzers:

    make -C fuzz fuzz-xml