From 44628d45595313fc353eca824e96def165234356 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Fri, 13 Dec 2024 15:23:30 +0100 Subject: [PATCH] fuzz: Harden leak check in lint fuzzer Check for undetected memory leaks from previous iterations. This also makes sure that the maxmem limit is checked deterministically. --- fuzz/lint.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fuzz/lint.c b/fuzz/lint.c index ca28d6f10..82de44b25 100644 --- a/fuzz/lint.c +++ b/fuzz/lint.c @@ -131,6 +131,11 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) { unsigned uval; int ival; + if (xmlMemUsed() != 0) { + fprintf(stderr, "Undetected leak in previous iteration\n"); + abort(); + } + vars.argv = malloc((numSwitches + 5 + 6 * 2) * sizeof(vars.argv[0])); vars.argi = 0; pushArg("xmllint"),