Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96203256 authored by Branden Archer's avatar Branden Archer
Browse files

Move serialize/deserialize fuzzing to separate function

In the future there will be other fuzzing handled in this
fuzzer. Moving the existing code to a separate function to
make adding new fuzzing simpler.

Bug: 170243740
Test: Builds and runs
Change-Id: I7b0f6b70f6d3855d67c0230b8ec78a16251c50c8
parent 59842065
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ struct FuzzType {

// Fuzzer for Serialization operations, this is mostly just lifted from the
// existing test cases to use fuzzed values as inputs.
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
void FuzzSerializeDeserialize(const uint8_t* data, size_t size) {
  FuzzedDataProvider fdp = FuzzedDataProvider(data, size);
  Payload result;

@@ -106,6 +106,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  Deserialize(&vec_val, &result);
  Serialize(t1_val, &result);
  Deserialize(&t1_val, &result);
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  FuzzSerializeDeserialize(data, size);

  return 0;
}