Skip to content

Commit 7b52088

Browse files
committed
fix(path traversal): sanitizers should not cause exceptions
1 parent 37ea437 commit 7b52088

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

sanitizers/src/main/java/com/code_intelligence/jazzer/sanitizers/FilePathTraversal.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,14 @@ private static void check(Path p) {
342342
return;
343343
}
344344

345-
if (p.toAbsolutePath().normalize().equals(ABSOLUTE_TARGET)) {
345+
// catch all exceptions that might be thrown by the sanitizer
346+
Path normalized;
347+
try {
348+
normalized = p.toAbsolutePath().normalize();
349+
} catch (InvalidPathException e) {
350+
return;
351+
}
352+
if (normalized.equals(ABSOLUTE_TARGET)) {
346353
Jazzer.reportFindingFromHook(new FuzzerSecurityIssueCritical("File path traversal: " + p));
347354
}
348355
}

0 commit comments

Comments
 (0)