diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2022-12-06 17:41:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 17:41:58 +0100 |
commit | ada4fe4aa8f88300cfc0dbe6ee965975274b1c40 (patch) | |
tree | 08010d2055d0159330ded8e5c15113deb0c41c3b /src/lib/ndpi_utils.c | |
parent | 946c3dba0f6c393c2e41b98103cec3e7308fbf2c (diff) |
fuzz: add a new fuzzer testing memory allocation failures (#1818)
Try to fuzz error paths triggered by allocation errors.
Fix some errors already found by this new fuzzer.
Basic idea taken from: https://github.com/harfbuzz/harfbuzz/pull/2566/files
`FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` is a standard define used to
(not)compile specific code in fuzzing builds.
See: https://llvm.org/docs/LibFuzzer.html
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r-- | src/lib/ndpi_utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index ee6f076ab..b0922acd7 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -131,8 +131,9 @@ void * ndpi_tsearch(const void *vkey, void **vrootp, *rootp = q; /* link new node to old */ q->key = key; /* initialize new node */ q->left = q->right = (ndpi_node *)0; + return ((void *)q->key); } - return ((void *)q->key); + return ((void *)0); } /* ****************************************** */ |