AuthGraph: add fuzzer am: 6fb22dc9ef am: db141272d4 am: a37c62f3a9

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2817763

Change-Id: I056c81baff57527464372b223ed1fc7b97157c9a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
David Drysdale 2023-11-09 09:10:10 +00:00 committed by Automerger Merge Worker
commit 74ccba03db
2 changed files with 48 additions and 0 deletions

View file

@ -63,3 +63,20 @@ rust_binary {
"src/main.rs",
],
}
rust_fuzz {
name: "android.hardware.authgraph-service.nonsecure_fuzzer",
rustlibs: [
"libauthgraph_hal",
"libauthgraph_nonsecure",
"libbinder_random_parcel_rs",
"libbinder_rs",
],
srcs: ["src/fuzzer.rs"],
fuzz_config: {
cc: [
"drysdale@google.com",
"hasinitg@google.com",
],
},
}

View file

@ -0,0 +1,31 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#![allow(missing_docs)]
#![no_main]
extern crate libfuzzer_sys;
use authgraph_hal::service::AuthGraphService;
use authgraph_nonsecure::LocalTa;
use binder_random_parcel_rs::fuzz_service;
use libfuzzer_sys::fuzz_target;
use std::sync::{Arc, Mutex};
fuzz_target!(|data: &[u8]| {
let local_ta = LocalTa::new();
let service = AuthGraphService::new_as_binder(Arc::new(Mutex::new(local_ta)));
fuzz_service(&mut service.as_binder(), data);
});