Set execution as valid after mutation.
Test: SANITIZE_TARGET="address coverage" make vts -j64 && vts-tradefed
run commandAndExit vts --skip-all-system-status-check --primary-abi-only
--skip-preconditions -l VERBOSE --module VtsHalBluetoothV1_0IfaceFuzzer
Change-Id: I9c75cfe7b6b5c3184303cce3ca536db60e71598b
diff --git a/iface_fuzzer/ProtoFuzzerMain.cpp b/iface_fuzzer/ProtoFuzzerMain.cpp
index 59ec328..6b79192 100644
--- a/iface_fuzzer/ProtoFuzzerMain.cpp
+++ b/iface_fuzzer/ProtoFuzzerMain.cpp
@@ -83,14 +83,13 @@
extern "C" size_t LLVMFuzzerCustomMutator(uint8_t *data, size_t size,
size_t max_size, unsigned int seed) {
ExecSpec exec_spec{};
- if (!exec_spec.ParseFromArray(data, size)) {
+ if (!FromArray(data, size, &exec_spec)) {
exec_spec =
mutator->RandomGen(runner->GetOpenedIfaces(), params.exec_size_);
} else {
mutator->Mutate(runner->GetOpenedIfaces(), &exec_spec);
}
- exec_spec.SerializeToArray(data, exec_spec.ByteSize());
- return exec_spec.ByteSize();
+ return ToArray(data, size, &exec_spec);
}
// TODO(trong): implement a meaningful cross-over mechanism.
@@ -103,9 +102,9 @@
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
- ExecSpec exec_spec;
- if (!exec_spec.ParseFromArray(data, size) ||
- exec_spec.function_call_size() == 0) {
+ ExecSpec exec_spec{};
+ if (!FromArray(data, size, &exec_spec)) {
+ cerr << "Failed to deserialize an ExecSpec." << endl;
return 0;
}
runner->Execute(exec_spec);