summaryrefslogtreecommitdiff
path: root/fuzz/schema.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2020-12-16 15:41:52 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2020-12-16 16:12:07 +0100
commit9086988ffa8da62c25c764a146a84603629734aa (patch)
tree69063f4c267aa53674191ec47643da1c096b0c4d /fuzz/schema.c
parent1fe385304f11332ddb232571d54d36a5aeca0398 (diff)
downloadlibxml2-9086988ffa8da62c25c764a146a84603629734aa.tar.gz
Enforce maximum length of fuzz input
Remove the libfuzzer max_len option which doesn't apply to other fuzzing engines. Enforce the maximum length directly in the fuzz targets. For the xml target, lower the maximum when expanding entities to avoid timeout and OOM errors.
Diffstat (limited to 'fuzz/schema.c')
-rw-r--r--fuzz/schema.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fuzz/schema.c b/fuzz/schema.c
index f1ee9380..7b034eca 100644
--- a/fuzz/schema.c
+++ b/fuzz/schema.c
@@ -21,6 +21,9 @@ int
LLVMFuzzerTestOneInput(const char *data, size_t size) {
xmlSchemaParserCtxtPtr pctxt;
+ if (size > 50000)
+ return(0);
+
xmlFuzzDataInit(data, size);
xmlFuzzReadEntities();