Have the fuzzers check for internal errors

This commit is contained in:
Nigel Tao committed 2019-02-02 12:08:44 +11:00
1 parent 92f3958a28
commit e9709992e2
2 files changed
+10 -2

No files matched your search

+8 -1
View File
@@ -15,6 +15,7 @@
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef WUFFS_INCLUDE_GUARD
#error "Wuffs' .h files need to be included before this file"
@@ -53,7 +54,13 @@ static const char* llvmFuzzerTestOneInput(const uint8_t* data, size_t size) {
.closed = true,
}),
});
return fuzz(wuffs_base__io_buffer__reader(&src), hash);
const char* msg = fuzz(wuffs_base__io_buffer__reader(&src), hash);
if (msg && strstr(msg, "internal error:")) {
fprintf(stderr, "internal errors shouldn't occur: \"%s\"\n", msg);
intentional_segfault();
}
return msg;
}
#ifdef __cplusplus
+2 -1
View File
@@ -79,7 +79,8 @@ const char* fuzz(wuffs_base__io_reader src_reader, uint32_t hash) {
break;
}
if (dst.meta.wi == 0) {
fprintf(stderr, "wuffs_zlib__decoder__decode made no progress\n");
fprintf(stderr,
"wuffs_zlib__decoder__decode_io_writer made no progress\n");
intentional_segfault();
}
}