File tree Expand file tree Collapse file tree 3 files changed +2
-19
lines changed
sanitizers/src/test/java/com/example Expand file tree Collapse file tree 3 files changed +2
-19
lines changed Original file line number Diff line number Diff line change 1616
1717package com .example ;
1818
19- import com .code_intelligence .jazzer .mutation .annotation .DoubleInRange ;
2019import com .code_intelligence .jazzer .mutation .annotation .NotNull ;
2120import com .code_intelligence .jazzer .mutation .annotation .WithUtf8Length ;
2221import java .io .BufferedReader ;
@@ -32,21 +31,14 @@ public class AbsoluteFilePathTraversal {
3231 System .setProperty ("jazzer.file_path_traversal_target" , "/custom/path/jazzer-traversal" );
3332 }
3433
35- public static void fuzzerTestOneInput (
36- @ WithUtf8Length (max = 100 ) @ NotNull String pathFromFuzzer ,
37- @ NotNull @ DoubleInRange (min = 0.0 , max = 1.0 ) Double fixedPathProbability ) {
38- // Slow down the fuzzer a bit, otherwise it finds file path traversal way too quickly!
39- String path = fixedPathProbability < 0.95 ? "/a/b/c/fixed-path" : pathFromFuzzer ;
40-
34+ public static void fuzzerTestOneInput (@ WithUtf8Length (max = 100 ) @ NotNull String path ) {
4135 try {
4236 Path p = Paths .get (path );
4337 try (BufferedReader r = Files .newBufferedReader (p , StandardCharsets .UTF_8 )) {
4438 r .read ();
4539 } catch (IOException ignored ) {
46- // swallow
4740 }
4841 } catch (InvalidPathException ignored ) {
49- // swallow
5042 }
5143 }
5244}
Original file line number Diff line number Diff line change @@ -67,7 +67,6 @@ java_fuzz_target_test(
6767 "com.code_intelligence.jazzer.api.FuzzerSecurityIssueCritical" ,
6868 ],
6969 target_class = "com.example.AbsoluteFilePathTraversal" ,
70- #not clear why reproducer doesn't work TODO -- fix this
7170 verify_crash_reproducer = False ,
7271 deps = [
7372 "//src/main/java/com/code_intelligence/jazzer/mutation/annotation" ,
@@ -83,7 +82,6 @@ java_fuzz_target_test(
8382 "com.code_intelligence.jazzer.api.FuzzerSecurityIssueCritical" ,
8483 ],
8584 target_class = "com.example.FilePathTraversal" ,
86- #not clear why reproducer doesn't work TODO -- fix this
8785 verify_crash_reproducer = False ,
8886 deps = [
8987 "//src/main/java/com/code_intelligence/jazzer/mutation/annotation" ,
Original file line number Diff line number Diff line change 1616
1717package com .example ;
1818
19- import com .code_intelligence .jazzer .mutation .annotation .DoubleInRange ;
2019import com .code_intelligence .jazzer .mutation .annotation .NotNull ;
2120import com .code_intelligence .jazzer .mutation .annotation .WithUtf8Length ;
2221import java .io .BufferedReader ;
2928
3029public class FilePathTraversal {
3130
32- public static void fuzzerTestOneInput (
33- @ WithUtf8Length (max = 100 ) @ NotNull String pathFromFuzzer ,
34- @ NotNull @ DoubleInRange (min = 0.0 , max = 1.0 ) Double fixedPathProbability ) {
35- // Slow down the fuzzer a bit, otherwise it finds file path traversal way too quickly!
36- String path = fixedPathProbability < 0.95 ? "/a/b/c/fixed-path" : pathFromFuzzer ;
31+ public static void fuzzerTestOneInput (@ WithUtf8Length (max = 100 ) @ NotNull String path ) {
3732 try {
3833 Path p = Paths .get (path );
3934 try (BufferedReader r = Files .newBufferedReader (p , StandardCharsets .UTF_8 )) {
4035 r .read ();
4136 } catch (IOException ignored ) {
42- // swallow
4337 }
4438 } catch (InvalidPathException ignored ) {
45- // swallow
4639 }
4740 }
4841}
You can’t perform that action at this time.
0 commit comments