diff options
author | Eduardo Rocha <edro@google.com> | 2020-07-16 18:35:06 +0000 |
---|---|---|
committer | Ryan Mitchell <rtmitchell@google.com> | 2020-07-21 13:51:37 +0000 |
commit | 935178e2fdfb08cca31da985846fb2a01f712b2e (patch) | |
tree | f5deaebe577f46e68a1924c9169473e09243a665 /libs/androidfw/fuzz/resourcefile_fuzzer/resourcefile_fuzzer.cpp | |
parent | 77d486426222b905e104f8203ec3a2faa348fe62 (diff) |
Fuzzer for libandroidfw
Bug: 161463861
Test: Builds and runs on host and device.
Change-Id: I78b19376275dc5a29afcab48c70eea479bff8728
Diffstat (limited to 'libs/androidfw/fuzz/resourcefile_fuzzer/resourcefile_fuzzer.cpp')
-rw-r--r-- | libs/androidfw/fuzz/resourcefile_fuzzer/resourcefile_fuzzer.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libs/androidfw/fuzz/resourcefile_fuzzer/resourcefile_fuzzer.cpp b/libs/androidfw/fuzz/resourcefile_fuzzer/resourcefile_fuzzer.cpp new file mode 100644 index 000000000000..96d44ab8e45c --- /dev/null +++ b/libs/androidfw/fuzz/resourcefile_fuzzer/resourcefile_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2020 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. + */ + +#include <stddef.h> +#include <stdint.h> +#include <string.h> +#include <string> +#include <memory> + +#include <androidfw/ApkAssets.h> +#include <androidfw/LoadedArsc.h> +#include <androidfw/StringPiece.h> + +#include <fuzzer/FuzzedDataProvider.h> + +using android::ApkAssets; +using android::LoadedArsc; +using android::StringPiece; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + + std::unique_ptr<const LoadedArsc> loaded_arsc = + LoadedArsc::Load(StringPiece(reinterpret_cast<const char*>(data), size)); + + return 0; +}
\ No newline at end of file |