Dan Albert | 7ce8df3 | 2016-09-23 16:43:49 -0700 | [diff] [blame] | 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 | |
Bob Badour | e539dba | 2021-02-12 17:07:05 -0800 | [diff] [blame] | 15 | package { |
| 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 | |
Colin Cross | 02a8657 | 2017-10-07 18:38:31 -0700 | [diff] [blame] | 24 | cc_library_shared { |
| 25 | name: "libjnigraphics", |
Elliott Hughes | 395607d | 2024-06-18 18:23:59 +0000 | [diff] [blame^] | 26 | defaults: [ |
| 27 | "bug_24465209_workaround", |
| 28 | ], |
Colin Cross | 02a8657 | 2017-10-07 18:38:31 -0700 | [diff] [blame] | 29 | |
| 30 | cflags: [ |
| 31 | "-Wall", |
| 32 | "-Werror", |
| 33 | "-Wunused", |
| 34 | "-Wunreachable-code", |
| 35 | ], |
| 36 | |
Leon Scroggins III | 9732e29 | 2019-12-16 10:26:57 -0500 | [diff] [blame] | 37 | srcs: [ |
Leon Scroggins III | 407b544 | 2019-11-22 17:10:20 -0500 | [diff] [blame] | 38 | "imagedecoder.cpp", |
Leon Scroggins III | 9732e29 | 2019-12-16 10:26:57 -0500 | [diff] [blame] | 39 | ], |
Colin Cross | 02a8657 | 2017-10-07 18:38:31 -0700 | [diff] [blame] | 40 | |
| 41 | shared_libs: [ |
Leon Scroggins III | 407b544 | 2019-11-22 17:10:20 -0500 | [diff] [blame] | 42 | "libhwui", |
Leon Scroggins III | 9732e29 | 2019-12-16 10:26:57 -0500 | [diff] [blame] | 43 | "liblog", |
Colin Cross | 02a8657 | 2017-10-07 18:38:31 -0700 | [diff] [blame] | 44 | ], |
Ian Pedowitz | 0c3c4d1 | 2018-01-18 16:24:11 -0800 | [diff] [blame] | 45 | |
Leon Scroggins III | c72d0fb | 2020-12-30 16:38:23 -0500 | [diff] [blame] | 46 | header_libs: [ |
Leon Scroggins III | c72d0fb | 2020-12-30 16:38:23 -0500 | [diff] [blame] | 47 | "jni_headers", |
Orion Hodson | 9b4db53 | 2021-02-02 11:19:04 +0000 | [diff] [blame] | 48 | "libhwui_internal_headers", |
Leon Scroggins III | c72d0fb | 2020-12-30 16:38:23 -0500 | [diff] [blame] | 49 | ], |
Derek Sollenberger | ee538a3 | 2020-02-19 11:51:17 -0500 | [diff] [blame] | 50 | |
Leon Scroggins III | 407b544 | 2019-11-22 17:10:20 -0500 | [diff] [blame] | 51 | static_libs: ["libarect"], |
| 52 | |
Leon Scroggins III | c72d0fb | 2020-12-30 16:38:23 -0500 | [diff] [blame] | 53 | host_supported: true, |
| 54 | target: { |
| 55 | android: { |
| 56 | srcs: [ |
| 57 | "aassetstreamadaptor.cpp", |
| 58 | "bitmap.cpp", |
| 59 | ], |
| 60 | shared_libs: [ |
| 61 | "libandroid", |
| 62 | ], |
| 63 | version_script: "libjnigraphics.map.txt", |
| 64 | }, |
| 65 | host: { |
| 66 | header_libs: [ |
| 67 | "libnativewindow_headers", |
| 68 | ], |
| 69 | }, |
| 70 | }, |
Jooyung Han | 7a82df9 | 2024-01-25 07:45:05 +0900 | [diff] [blame] | 71 | stubs: { |
| 72 | symbol_file: "libjnigraphics.map.txt", |
| 73 | }, |
Colin Cross | 02a8657 | 2017-10-07 18:38:31 -0700 | [diff] [blame] | 74 | } |
| 75 | |
Dan Albert | 7ce8df3 | 2016-09-23 16:43:49 -0700 | [diff] [blame] | 76 | // The headers module is in frameworks/native/Android.bp. |
| 77 | ndk_library { |
Dan Willemsen | 3dcf031 | 2017-04-07 15:48:45 -0700 | [diff] [blame] | 78 | name: "libjnigraphics", |
Dan Albert | 7ce8df3 | 2016-09-23 16:43:49 -0700 | [diff] [blame] | 79 | symbol_file: "libjnigraphics.map.txt", |
| 80 | first_version: "9", |
Dan Albert | 98e462d | 2017-01-05 16:01:14 -0800 | [diff] [blame] | 81 | unversioned_until: "current", |
Dan Albert | 7ce8df3 | 2016-09-23 16:43:49 -0700 | [diff] [blame] | 82 | } |
Leon Scroggins III | 140f508 | 2020-02-26 17:15:12 -0500 | [diff] [blame] | 83 | |
Leon Scroggins III | 8f77424 | 2021-01-15 11:33:23 -0500 | [diff] [blame] | 84 | cc_defaults { |
| 85 | name: "imagedecoder_fuzzer_defaults", |
| 86 | srcs: ["fuzz/fuzz_imagedecoder.cpp"], |
Leon Scroggins III | 140f508 | 2020-02-26 17:15:12 -0500 | [diff] [blame] | 87 | header_libs: ["jni_headers"], |
| 88 | shared_libs: [ |
| 89 | "libbinder", |
| 90 | "libjnigraphics", |
| 91 | "libutils", |
| 92 | ], |
| 93 | static_libs: ["libarect"], |
| 94 | fuzz_config: { |
Jooyung Han | f939414 | 2024-01-25 08:00:28 +0900 | [diff] [blame] | 95 | cc: [ |
| 96 | "dichenzhang@google.com", |
| 97 | "scroggo@google.com", |
| 98 | ], |
Leon Scroggins III | c72d0fb | 2020-12-30 16:38:23 -0500 | [diff] [blame] | 99 | asan_options: [ |
| 100 | "detect_odr_violation=1", |
| 101 | ], |
Leon Scroggins III | ba9a690 | 2021-01-11 11:35:10 -0500 | [diff] [blame] | 102 | hwasan_options: [ |
Jooyung Han | f939414 | 2024-01-25 08:00:28 +0900 | [diff] [blame] | 103 | // Image decoders may attempt to allocate a large amount of memory |
| 104 | // (especially if the encoded image is large). This doesn't |
| 105 | // necessarily mean there is a bug. Set allocator_may_return_null=1 |
| 106 | // for hwasan so the fuzzer can continue running. |
Leon Scroggins III | ba9a690 | 2021-01-11 11:35:10 -0500 | [diff] [blame] | 107 | "allocator_may_return_null = 1", |
| 108 | ], |
Leon Scroggins III | 140f508 | 2020-02-26 17:15:12 -0500 | [diff] [blame] | 109 | }, |
Onkar Shinde | 85c8496 | 2024-04-25 15:58:31 +0530 | [diff] [blame] | 110 | dictionary: "fuzz/imagedecoder_fuzzer.dict", |
Leon Scroggins III | c72d0fb | 2020-12-30 16:38:23 -0500 | [diff] [blame] | 111 | host_supported: true, |
Leon Scroggins III | 140f508 | 2020-02-26 17:15:12 -0500 | [diff] [blame] | 112 | } |
Leon Scroggins III | 8f77424 | 2021-01-15 11:33:23 -0500 | [diff] [blame] | 113 | |
| 114 | cc_fuzz { |
| 115 | name: "imagedecoder_fuzzer", |
| 116 | defaults: ["imagedecoder_fuzzer_defaults"], |
| 117 | corpus: ["fuzz/corpus/*"], |
| 118 | } |
| 119 | |
| 120 | cc_fuzz { |
| 121 | name: "imagedecoder_png_fuzzer", |
| 122 | defaults: ["imagedecoder_fuzzer_defaults"], |
| 123 | shared_libs: [ |
| 124 | "libz", |
| 125 | ], |
| 126 | cflags: [ |
| 127 | "-DPNG_MUTATOR_DEFINE_LIBFUZZER_CUSTOM_MUTATOR", |
| 128 | ], |
| 129 | } |