mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Have the fuzzers check for internal errors
This commit is contained in:
1 parent
92f3958a28
commit
e9709992e2
2 files changed
+10
-2
No files matched your search
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user