1// Copyright (C) 2016 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package { 16 // See: http://go/android-license-faq 17 // A large-scale-change added 'default_applicable_licenses' to import 18 // all of the 'license_kinds' from "frameworks_base_license" 19 // to get the below license kinds: 20 // SPDX-license-identifier-Apache-2.0 21 default_applicable_licenses: ["frameworks_base_license"], 22} 23 24cc_library_shared { 25 name: "libjnigraphics", 26 defaults: [ 27 "bug_24465209_workaround", 28 ], 29 30 cflags: [ 31 "-Wall", 32 "-Werror", 33 "-Wunused", 34 "-Wunreachable-code", 35 ], 36 37 srcs: [ 38 "imagedecoder.cpp", 39 ], 40 41 shared_libs: [ 42 "libhwui", 43 "liblog", 44 ], 45 46 header_libs: [ 47 "jni_headers", 48 "native_headers", 49 "libhwui_internal_headers", 50 ], 51 export_header_lib_headers: ["native_headers"], 52 53 static_libs: [ 54 "libarect", 55 ], 56 57 host_supported: true, 58 target: { 59 android: { 60 srcs: [ 61 "aassetstreamadaptor.cpp", 62 "bitmap.cpp", 63 ], 64 shared_libs: [ 65 "libandroid", 66 ], 67 static_libs: [ 68 "libstatslog_hwui", 69 "libstatspull_lazy", 70 "libstatssocket_lazy", 71 ], 72 version_script: "libjnigraphics.map.txt", 73 }, 74 host: { 75 header_libs: [ 76 "libnativewindow_headers", 77 ], 78 }, 79 }, 80 stubs: { 81 symbol_file: "libjnigraphics.map.txt", 82 }, 83} 84 85// The headers module is in frameworks/native/Android.bp. 86ndk_library { 87 name: "libjnigraphics", 88 symbol_file: "libjnigraphics.map.txt", 89 first_version: "9", 90 unversioned_until: "current", 91} 92 93cc_defaults { 94 name: "imagedecoder_fuzzer_defaults", 95 srcs: ["fuzz/fuzz_imagedecoder.cpp"], 96 header_libs: ["jni_headers"], 97 shared_libs: [ 98 "libbinder", 99 "libjnigraphics", 100 "libutils", 101 ], 102 static_libs: ["libarect"], 103 fuzz_config: { 104 cc: [ 105 "[email protected]", 106 "[email protected]", 107 ], 108 asan_options: [ 109 "detect_odr_violation=1", 110 ], 111 hwasan_options: [ 112 // Image decoders may attempt to allocate a large amount of memory 113 // (especially if the encoded image is large). This doesn't 114 // necessarily mean there is a bug. Set allocator_may_return_null=1 115 // for hwasan so the fuzzer can continue running. 116 "allocator_may_return_null = 1", 117 ], 118 }, 119 dictionary: "fuzz/imagedecoder_fuzzer.dict", 120 host_supported: true, 121} 122 123cc_fuzz { 124 name: "imagedecoder_fuzzer", 125 defaults: ["imagedecoder_fuzzer_defaults"], 126 corpus: ["fuzz/corpus/*"], 127} 128 129cc_fuzz { 130 name: "imagedecoder_png_fuzzer", 131 defaults: ["imagedecoder_fuzzer_defaults"], 132 shared_libs: [ 133 "libz", 134 ], 135 cflags: [ 136 "-DPNG_MUTATOR_DEFINE_LIBFUZZER_CUSTOM_MUTATOR", 137 ], 138} 139 140cc_fuzz { 141 name: "imagedecoder_heif_fuzzer", 142 defaults: ["imagedecoder_fuzzer_defaults"], 143 team: "trendy_team_android_core_graphics_stack", 144 shared_libs: [ 145 "libfakeservicemanager", 146 ], 147 target: { 148 android: { 149 shared_libs: [ 150 "libmediaplayerservice", 151 "libmediaextractorservice", 152 ], 153 }, 154 host: { 155 static_libs: [ 156 "libbinder_random_parcel", 157 "libcutils", 158 ], 159 }, 160 }, 161 include_dirs: ["frameworks/av/services/mediaextractor"], 162 cflags: [ 163 "-DFUZZ_HEIF_FORMAT", 164 ], 165} 166