Adding skeleton for a rust fuzzer for legacy_blob
Test: m legacy_blob_fuzzer & adb sync data & adb shell legacy_blob_fuzzer The edge coverage after running for few minutes was about 15 percent. Change-Id: I8a8a535319c6146c67980e6c31e5c85c420e40e7
This commit is contained in:
parent
1bca8c905e
commit
266abdb627
2 changed files with 53 additions and 0 deletions
29
keystore2/src/fuzzers/Android.bp
Normal file
29
keystore2/src/fuzzers/Android.bp
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2021, 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.
|
||||
|
||||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
rust_fuzz {
|
||||
name: "legacy_blob_fuzzer",
|
||||
srcs: ["legacy_blob_fuzzer.rs"],
|
||||
rustlibs: [
|
||||
"libkeystore2",
|
||||
],
|
||||
fuzz_config: {
|
||||
fuzz_on_haiku_device: true,
|
||||
fuzz_on_haiku_host: false,
|
||||
},
|
||||
}
|
24
keystore2/src/fuzzers/legacy_blob_fuzzer.rs
Normal file
24
keystore2/src/fuzzers/legacy_blob_fuzzer.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2021, 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]
|
||||
#[macro_use]
|
||||
extern crate libfuzzer_sys;
|
||||
use keystore2::legacy_blob::LegacyBlobLoader;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let string = data.iter().filter_map(|c| std::char::from_u32(*c as u32)).collect::<String>();
|
||||
let _res = LegacyBlobLoader::decode_alias(&string);
|
||||
});
|
Loading…
Reference in a new issue