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