File tree Expand file tree Collapse file tree 4 files changed +41
-2
lines changed
main/java/com/code_intelligence/jazzer/sanitizers Expand file tree Collapse file tree 4 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -326,6 +326,7 @@ java_fuzz_target_test(
326326 "src/main/java/com/example/JsonSanitizerValidJsonFuzzer.java" ,
327327 ],
328328 allowed_findings = ["com.code_intelligence.jazzer.api.FuzzerSecurityIssueLow" ],
329+ expected_warning_or_error = "WARN: Some hooks could not be applied to class files built for Java 7 or lower." ,
329330 target_class = "com.example.JsonSanitizerValidJsonFuzzer" ,
330331 deps = [
331332 "@maven//:com_google_code_gson_gson" ,
Original file line number Diff line number Diff line change @@ -107,13 +107,13 @@ object RegexInjection {
107107 type = HookType .REPLACE ,
108108 targetClassName = " java.lang.String" ,
109109 targetMethod = " split" ,
110- targetMethodDescriptor = " (Ljava/lang/String;)Ljava/lang/String;" ,
110+ targetMethodDescriptor = " (Ljava/lang/String;)[ Ljava/lang/String;" ,
111111 ),
112112 MethodHook (
113113 type = HookType .REPLACE ,
114114 targetClassName = " java.lang.String" ,
115115 targetMethod = " split" ,
116- targetMethodDescriptor = " (Ljava/lang/String;I)Ljava/lang/String;" ,
116+ targetMethodDescriptor = " (Ljava/lang/String;I)[ Ljava/lang/String;" ,
117117 ),
118118 )
119119 @JvmStatic
Original file line number Diff line number Diff line change @@ -215,6 +215,14 @@ java_fuzz_target_test(
215215 verify_crash_reproducer = False ,
216216)
217217
218+ java_fuzz_target_test (
219+ name = "RegexSplitInjection" ,
220+ srcs = ["RegexSplitInjection.java" ],
221+ allowed_findings = ["com.code_intelligence.jazzer.api.FuzzerSecurityIssueLow" ],
222+ target_class = "com.example.RegexSplitInjection" ,
223+ verify_crash_reproducer = False ,
224+ )
225+
218226java_fuzz_target_test (
219227 name = "RegexCanonEqInjection" ,
220228 srcs = [
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2025 Code Intelligence GmbH
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ package com .example ;
18+
19+ import com .code_intelligence .jazzer .api .FuzzedDataProvider ;
20+ import java .util .regex .PatternSyntaxException ;
21+
22+ public class RegexSplitInjection {
23+ public static void fuzzerTestOneInput (FuzzedDataProvider fdp ) {
24+ String regex = fdp .consumeRemainingAsString ();
25+ try {
26+ "foobar" .split (regex );
27+ } catch (PatternSyntaxException ignored ) {
28+ }
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments