Loading media/libmediaplayerservice/Android.bp +29 −15 Original line number Diff line number Diff line Loading @@ -17,7 +17,8 @@ license { ], } cc_library { filegroup { name: "libmediaplayerservice_sources", srcs: [ "ActivityManager.cpp", Loading @@ -30,6 +31,14 @@ cc_library { "StagefrightRecorder.cpp", "TestPlayerStub.cpp", ], } cc_defaults { name: "libmediaplayerservice_defaults", srcs: [ ":libmediaplayerservice_sources", ], shared_libs: [ "android.hardware.media.c2@1.0", Loading Loading @@ -83,6 +92,24 @@ cc_library { "framework-permission-aidl-cpp", ], cflags: [ "-Werror", "-Wno-error=deprecated-declarations", "-Wall", ], sanitize: { cfi: true, }, } cc_library { name: "libmediaplayerservice", defaults: [ "libmediaplayerservice_defaults", ], export_shared_lib_headers: [ "libmedia", "framework-permission-aidl-cpp", Loading @@ -92,22 +119,9 @@ cc_library { "libmediautils_headers", ], local_include_dirs: ["include"], export_include_dirs: [ ".", ], cflags: [ "-Werror", "-Wno-error=deprecated-declarations", "-Wall", ], name: "libmediaplayerservice", sanitize: { cfi: true, }, local_include_dirs: ["include"], } media/libmediaplayerservice/MediaPlayerService.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -3038,4 +3038,11 @@ status_t MediaPlayerService::BatteryTracker::pullBatteryData(Parcel* reply) { } return NO_ERROR; } #ifdef FUZZ_MODE_MEDIA_PLAYER_SERVICE sp<MediaPlayerService> MediaPlayerService::createForFuzzTesting() { return sp<MediaPlayerService>::make(); } #endif // FUZZ_MODE_MEDIA_PLAYER_SERVICE } // namespace android media/libmediaplayerservice/MediaPlayerService.h +6 −0 Original line number Diff line number Diff line Loading @@ -505,6 +505,12 @@ private: SortedVector< wp<Client> > mClients; SortedVector< wp<MediaRecorderClient> > mMediaRecorderClients; int32_t mNextConnId; #ifdef FUZZ_MODE_MEDIA_PLAYER_SERVICE public: friend class sp<MediaPlayerService>; static sp<MediaPlayerService> createForFuzzTesting(); #endif // FUZZ_MODE_MEDIA_PLAYER_SERVICE }; // ---------------------------------------------------------------------------- Loading media/libmediaplayerservice/fuzzer/Android.bp +23 −0 Original line number Diff line number Diff line Loading @@ -139,3 +139,26 @@ cc_fuzz { "libstagefright_httplive", ], } cc_fuzz { name: "media_player_service_fuzzer", defaults: [ "service_fuzzer_defaults", "libmediaplayerservice_defaults", "fuzzer_disable_leaks", ], srcs: [ "media_player_service_fuzzer.cpp", ], fuzz_config: { cc: [ "kyslov@google.com", "ibaker@google.com", ], triage_assignee: "waghpawan@google.com", }, cflags: [ "-DFUZZ_MODE_MEDIA_PLAYER_SERVICE", ], include_dirs: ["frameworks/av/media/libmediaplayerservice/"], } media/libmediaplayerservice/fuzzer/media_player_service_fuzzer.cpp 0 → 100644 +29 −0 Original line number Diff line number Diff line /* * Copyright 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. */ #include <fuzzbinder/libbinder_driver.h> #include <fuzzer/FuzzedDataProvider.h> #include <MediaPlayerService.h> using android::fuzzService; using android::MediaPlayerService; extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { auto service = MediaPlayerService::createForFuzzTesting(); fuzzService(service, FuzzedDataProvider(data, size)); return 0; } Loading
media/libmediaplayerservice/Android.bp +29 −15 Original line number Diff line number Diff line Loading @@ -17,7 +17,8 @@ license { ], } cc_library { filegroup { name: "libmediaplayerservice_sources", srcs: [ "ActivityManager.cpp", Loading @@ -30,6 +31,14 @@ cc_library { "StagefrightRecorder.cpp", "TestPlayerStub.cpp", ], } cc_defaults { name: "libmediaplayerservice_defaults", srcs: [ ":libmediaplayerservice_sources", ], shared_libs: [ "android.hardware.media.c2@1.0", Loading Loading @@ -83,6 +92,24 @@ cc_library { "framework-permission-aidl-cpp", ], cflags: [ "-Werror", "-Wno-error=deprecated-declarations", "-Wall", ], sanitize: { cfi: true, }, } cc_library { name: "libmediaplayerservice", defaults: [ "libmediaplayerservice_defaults", ], export_shared_lib_headers: [ "libmedia", "framework-permission-aidl-cpp", Loading @@ -92,22 +119,9 @@ cc_library { "libmediautils_headers", ], local_include_dirs: ["include"], export_include_dirs: [ ".", ], cflags: [ "-Werror", "-Wno-error=deprecated-declarations", "-Wall", ], name: "libmediaplayerservice", sanitize: { cfi: true, }, local_include_dirs: ["include"], }
media/libmediaplayerservice/MediaPlayerService.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -3038,4 +3038,11 @@ status_t MediaPlayerService::BatteryTracker::pullBatteryData(Parcel* reply) { } return NO_ERROR; } #ifdef FUZZ_MODE_MEDIA_PLAYER_SERVICE sp<MediaPlayerService> MediaPlayerService::createForFuzzTesting() { return sp<MediaPlayerService>::make(); } #endif // FUZZ_MODE_MEDIA_PLAYER_SERVICE } // namespace android
media/libmediaplayerservice/MediaPlayerService.h +6 −0 Original line number Diff line number Diff line Loading @@ -505,6 +505,12 @@ private: SortedVector< wp<Client> > mClients; SortedVector< wp<MediaRecorderClient> > mMediaRecorderClients; int32_t mNextConnId; #ifdef FUZZ_MODE_MEDIA_PLAYER_SERVICE public: friend class sp<MediaPlayerService>; static sp<MediaPlayerService> createForFuzzTesting(); #endif // FUZZ_MODE_MEDIA_PLAYER_SERVICE }; // ---------------------------------------------------------------------------- Loading
media/libmediaplayerservice/fuzzer/Android.bp +23 −0 Original line number Diff line number Diff line Loading @@ -139,3 +139,26 @@ cc_fuzz { "libstagefright_httplive", ], } cc_fuzz { name: "media_player_service_fuzzer", defaults: [ "service_fuzzer_defaults", "libmediaplayerservice_defaults", "fuzzer_disable_leaks", ], srcs: [ "media_player_service_fuzzer.cpp", ], fuzz_config: { cc: [ "kyslov@google.com", "ibaker@google.com", ], triage_assignee: "waghpawan@google.com", }, cflags: [ "-DFUZZ_MODE_MEDIA_PLAYER_SERVICE", ], include_dirs: ["frameworks/av/media/libmediaplayerservice/"], }
media/libmediaplayerservice/fuzzer/media_player_service_fuzzer.cpp 0 → 100644 +29 −0 Original line number Diff line number Diff line /* * Copyright 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. */ #include <fuzzbinder/libbinder_driver.h> #include <fuzzer/FuzzedDataProvider.h> #include <MediaPlayerService.h> using android::fuzzService; using android::MediaPlayerService; extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { auto service = MediaPlayerService::createForFuzzTesting(); fuzzService(service, FuzzedDataProvider(data, size)); return 0; }