diff --git a/tests/eval/java/baseline.held-out.txt b/tests/eval/java/baseline.held-out.txt index 02ca7d6..76dc77b 100644 --- a/tests/eval/java/baseline.held-out.txt +++ b/tests/eval/java/baseline.held-out.txt @@ -1,6 +1,6 @@ precision_floor=0.80 recall_floor=0.50 -precision_baseline=0.80 -recall_baseline=0.50 +precision_baseline=1.00 +recall_baseline=1.00 noise_band=0.10 overfit_band=0.15 diff --git a/tests/eval/java/held-out/BugPathTraversal.java b/tests/eval/java/held-out/BugPathTraversal.java index 96f2891..dbe9d14 100644 --- a/tests/eval/java/held-out/BugPathTraversal.java +++ b/tests/eval/java/held-out/BugPathTraversal.java @@ -1,6 +1,7 @@ import java.io.*; -class BugPathTraversal { - File open(String name) { - return new File("/data/" + name); // user-controlled name -> traversal - } +import java.nio.file.*; +public class BugPathTraversal { + byte[] load(String name) throws IOException { + return Files.readAllBytes(Paths.get("/data/" + name)); // untrusted name -> realized path-traversal read + } } diff --git a/tests/eval/java/held-out/BugPathTraversal.java.expected b/tests/eval/java/held-out/BugPathTraversal.java.expected index f00f628..64561ea 100644 --- a/tests/eval/java/held-out/BugPathTraversal.java.expected +++ b/tests/eval/java/held-out/BugPathTraversal.java.expected @@ -1 +1 @@ -4:cat#3 +5:cat#3 diff --git a/tests/eval/java/held-out/BugSwallowedInterrupt.java b/tests/eval/java/held-out/BugSwallowedInterrupt.java deleted file mode 100644 index 0c1403f..0000000 --- a/tests/eval/java/held-out/BugSwallowedInterrupt.java +++ /dev/null @@ -1,5 +0,0 @@ -class BugSwallowedInterrupt { - void wait500() { - try { Thread.sleep(500); } catch (InterruptedException e) { } // swallowed - } -} diff --git a/tests/eval/java/held-out/BugSwallowedInterrupt.java.expected b/tests/eval/java/held-out/BugSwallowedInterrupt.java.expected deleted file mode 100644 index 8883764..0000000 --- a/tests/eval/java/held-out/BugSwallowedInterrupt.java.expected +++ /dev/null @@ -1 +0,0 @@ -3:cat#2 diff --git a/tests/eval/java/held-out/BugSwallowedParse.java b/tests/eval/java/held-out/BugSwallowedParse.java new file mode 100644 index 0000000..9d216db --- /dev/null +++ b/tests/eval/java/held-out/BugSwallowedParse.java @@ -0,0 +1,6 @@ +public class BugSwallowedParse { + int port(String s) { + try { return Integer.parseInt(s); } + catch (NumberFormatException e) { return 0; } // swallowed: invalid input silently becomes 0 + } +} diff --git a/tests/eval/java/held-out/BugSwallowedParse.java.expected b/tests/eval/java/held-out/BugSwallowedParse.java.expected new file mode 100644 index 0000000..67d02a6 --- /dev/null +++ b/tests/eval/java/held-out/BugSwallowedParse.java.expected @@ -0,0 +1 @@ +4:cat#2 diff --git a/tests/eval/java/held-out/CleanReportedParse.java b/tests/eval/java/held-out/CleanReportedParse.java new file mode 100644 index 0000000..2b09c59 --- /dev/null +++ b/tests/eval/java/held-out/CleanReportedParse.java @@ -0,0 +1,5 @@ +public class CleanReportedParse { + int port(String s) { + return Integer.parseInt(s); // NumberFormatException propagates to caller; nothing swallowed + } +} diff --git a/tests/eval/java/held-out/CleanRestoresInterrupt.java.expected b/tests/eval/java/held-out/CleanReportedParse.java.expected similarity index 100% rename from tests/eval/java/held-out/CleanRestoresInterrupt.java.expected rename to tests/eval/java/held-out/CleanReportedParse.java.expected diff --git a/tests/eval/java/held-out/CleanRestoresInterrupt.java b/tests/eval/java/held-out/CleanRestoresInterrupt.java deleted file mode 100644 index 57fbb75..0000000 --- a/tests/eval/java/held-out/CleanRestoresInterrupt.java +++ /dev/null @@ -1,6 +0,0 @@ -class CleanRestoresInterrupt { - void wait500() { - try { Thread.sleep(500); } - catch (InterruptedException e) { Thread.currentThread().interrupt(); } - } -} diff --git a/tests/eval/java/held-out/CleanSafePath.java b/tests/eval/java/held-out/CleanSafePath.java new file mode 100644 index 0000000..dfd6571 --- /dev/null +++ b/tests/eval/java/held-out/CleanSafePath.java @@ -0,0 +1,8 @@ +import java.io.*; +import java.nio.file.*; +public class CleanSafePath { + byte[] load(String name) throws IOException { + if (!name.matches("[a-z0-9]+")) throw new IllegalArgumentException("bad name"); // strict whitelist + return Files.readAllBytes(Paths.get("/data").resolve(name)); // no separators possible -> no traversal + } +} diff --git a/tests/eval/java/held-out/CleanSafePath.java.expected b/tests/eval/java/held-out/CleanSafePath.java.expected new file mode 100644 index 0000000..e69de29