Fix verifier null-deref bug
Verifier threads were not setting the timer, resulting
into a null-deref crash when first call to timer_gettime()
from verifier thread.
Signed-off-by: Anestis Bechtsoudis <anestis@census-labs.com>
diff --git a/fuzz.c b/fuzz.c
index ee82640..693ab8a 100644
--- a/fuzz.c
+++ b/fuzz.c
@@ -299,6 +299,7 @@
for (int i = 0; i < _HF_VERIFIER_ITER; i++) {
fuzzer_t vFuzzer = {
.pid = 0,
+ .persistentPid = 0,
.timeStartedMillis = util_timeNowMillis(),
.crashFileName = {0},
.pc = 0ULL,
@@ -328,9 +329,18 @@
},
.perfMmapBuf = NULL,
.perfMmapAux = NULL,
+#if defined(_HF_ARCH_LINUX)
+ .timerId = (timer_t) 0,
+#endif // defined(_HF_ARCH_LINUX)
+ .attachedPid = 0,
+ .persistentSock = -1,
},
};
+ if (arch_archThreadInit(hfuzz, &vFuzzer) == false) {
+ LOG_F("Could not initialize the thread");
+ }
+
fuzz_getFileName(hfuzz, vFuzzer.fileName);
if (files_writeBufToFile
(vFuzzer.fileName, crashBuf, crashFileSz,