aboutsummaryrefslogtreecommitdiff
path: root/examples/BUILD.bazel
blob: 54fbbc46b3afdab938b1af86565b55cbca0538a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
load("//bazel:fuzz_target.bzl", "java_fuzz_target_test")

java_fuzz_target_test(
    name = "ExampleFuzzer",
    srcs = [
        "src/main/java/com/example/ExampleFuzzer.java",
        "src/main/java/com/example/ExampleFuzzerHooks.java",
    ],
    # Comment out the next line to keep the fuzzer running indefinitely.
    hook_classes = ["com.example.ExampleFuzzerHooks"],
    target_class = "com.example.ExampleFuzzer",
)

java_fuzz_target_test(
    name = "ExampleFuzzerWithNative",
    srcs = [
        "src/main/java/com/example/ExampleFuzzerWithNative.java",
    ],
    native_libs = ["//examples/src/main/native"],
    target_class = "com.example.ExampleFuzzerWithNative",
    use_asan = True,
    deps = [
        "//agent:jazzer_api_deploy.jar",
    ],
)

java_fuzz_target_test(
    name = "ExampleValueProfileFuzzer",
    srcs = [
        "src/main/java/com/example/ExampleValueProfileFuzzer.java",
    ],
    # Comment out the next line to keep the fuzzer running indefinitely.
    fuzzer_args = ["-use_value_profile=1"],
    target_class = "com.example.ExampleValueProfileFuzzer",
)

java_fuzz_target_test(
    name = "JpegImageParserFuzzer",
    srcs = [
        "src/main/java/com/example/JpegImageParserFuzzer.java",
    ],
    target_class = "com.example.JpegImageParserFuzzer",
    deps = [
        "@maven//:org_apache_commons_commons_imaging",
    ],
)

java_fuzz_target_test(
    name = "GifImageParserFuzzer",
    srcs = [
        "src/main/java/com/example/GifImageParserFuzzer.java",
    ],
    target_class = "com.example.GifImageParserFuzzer",
    deps = [
        "@maven//:org_apache_commons_commons_imaging",
    ],
)

java_fuzz_target_test(
    name = "TiffImageParserFuzzer",
    srcs = [
        "src/main/java/com/example/TiffImageParserFuzzer.java",
    ],
    tags = ["manual"],
    target_class = "com.example.TiffImageParserFuzzer",
    deps = [
        "@maven//:org_apache_commons_commons_imaging",
    ],
)

java_fuzz_target_test(
    name = "JsonSanitizerFuzzer",
    srcs = [
        "src/main/java/com/example/JsonSanitizerFuzzer.java",
    ],
    target_class = "com.example.JsonSanitizerFuzzer",
    deps = [
        "@maven//:com_google_code_gson_gson",
        "@maven//:com_mikesamuel_json_sanitizer",
    ],
)

java_fuzz_target_test(
    name = "JacksonCborFuzzer",
    srcs = [
        "src/main/java/com/example/JacksonCborFuzzer.java",
    ],
    target_class = "com.example.JacksonCborFuzzer",
    deps = [
        "@maven//:com_fasterxml_jackson_core_jackson_core",
        "@maven//:com_fasterxml_jackson_core_jackson_databind",
        "@maven//:com_fasterxml_jackson_dataformat_jackson_dataformat_cbor",
    ],
)

java_fuzz_target_test(
    name = "FastJsonFuzzer",
    srcs = [
        "src/main/java/com/example/FastJsonFuzzer.java",
    ],
    target_class = "com.example.FastJsonFuzzer",
    deps = [
        "@maven//:com_alibaba_fastjson",
    ],
)

java_fuzz_target_test(
    name = "TurboJpegFuzzer",
    srcs = [
        "src/main/java/com/example/TurboJpegFuzzer.java",
    ],
    fuzzer_args = [
        "-rss_limit_mb=8196",
    ],
    native_libs = [
        "@libjpeg_turbo//:turbojpeg_native",
    ],
    tags = ["manual"],
    target_class = "com.example.TurboJpegFuzzer",
    use_asan = True,
    deps = [
        "@libjpeg_turbo//:turbojpeg_java",
    ],
)

java_binary(
    name = "examples",
    create_executable = False,
    resource_jars = [
        ":ExampleFuzzer_target_deploy.jar",
        ":ExampleValueProfileFuzzer_target_deploy.jar",
        ":FastJsonFuzzer_target_deploy.jar",
        ":GifImageParserFuzzer_target_deploy.jar",
        ":JacksonCborFuzzer_target_deploy.jar",
        ":JpegImageParserFuzzer_target_deploy.jar",
        ":JsonSanitizerFuzzer_target_deploy.jar",
        ":TiffImageParserFuzzer_target_deploy.jar",
    ],
    visibility = ["//visibility:public"],
)