• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
27    cflags: [
28        "-Wall",
29        "-Werror",
30        "-Wunused",
31        "-Wunreachable-code",
32    ],
33
34    srcs: [
35        "imagedecoder.cpp",
36    ],
37
38    shared_libs: [
39        "libhwui",
40        "liblog",
41    ],
42
43    header_libs: [
44        "jni_headers",
45        "libhwui_internal_headers",
46    ],
47
48    static_libs: ["libarect"],
49
50    arch: {
51        arm: {
52            // TODO: This is to work around b/24465209. Remove after root cause is fixed
53            pack_relocations: false,
54            ldflags: ["-Wl,--hash-style=both"],
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            version_script: "libjnigraphics.map.txt",
68        },
69        host: {
70            header_libs: [
71                "libnativewindow_headers",
72            ],
73        },
74    },
75}
76
77// The headers module is in frameworks/native/Android.bp.
78ndk_library {
79    name: "libjnigraphics",
80    symbol_file: "libjnigraphics.map.txt",
81    first_version: "9",
82    unversioned_until: "current",
83}
84
85cc_defaults {
86    name: "imagedecoder_fuzzer_defaults",
87    srcs: ["fuzz/fuzz_imagedecoder.cpp"],
88    header_libs: ["jni_headers"],
89    shared_libs: [
90        "libbinder",
91        "libjnigraphics",
92        "libutils",
93    ],
94    static_libs: ["libarect"],
95    fuzz_config: {
96        cc: ["scroggo@google.com"],
97        asan_options: [
98            "detect_odr_violation=1",
99        ],
100        hwasan_options: [
101             // Image decoders may attempt to allocate a large amount of memory
102             // (especially if the encoded image is large). This doesn't
103             // necessarily mean there is a bug. Set allocator_may_return_null=1
104             // for hwasan so the fuzzer can continue running.
105            "allocator_may_return_null = 1",
106        ],
107    },
108    host_supported: true,
109}
110
111cc_fuzz {
112    name: "imagedecoder_fuzzer",
113    defaults: ["imagedecoder_fuzzer_defaults"],
114    corpus: ["fuzz/corpus/*"],
115}
116
117cc_fuzz {
118    name: "imagedecoder_png_fuzzer",
119    defaults: ["imagedecoder_fuzzer_defaults"],
120    shared_libs: [
121        "libz",
122    ],
123    cflags: [
124        "-DPNG_MUTATOR_DEFINE_LIBFUZZER_CUSTOM_MUTATOR",
125    ],
126}
127