Skip to content

Commit

Permalink
fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
yawkat committed Jan 9, 2025
1 parent 6559f77 commit 19780a2
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,20 @@ public static LocalJazzerRunner create(@NonNull Class<?> fuzzTarget) {

private void writeDictionary(OutputStream out) throws IOException {
target.writeStaticDictionary(out);
for (String r : target.dictionaryResources()) {
Enumeration<URL> urls = LocalJazzerRunner.class.getClassLoader().getResources(r);
if (!urls.hasMoreElements()) {
throw new IllegalStateException("Dictionary resource " + r + " not found");
}
do {
DefinedFuzzTarget.writeResourceDictionaryPrefix(out, r);
try (InputStream in = urls.nextElement().openStream()) {
in.transferTo(out);
if (target.dictionaryResources() != null) {
for (String r : target.dictionaryResources()) {
Enumeration<URL> urls = LocalJazzerRunner.class.getClassLoader().getResources(r);
if (!urls.hasMoreElements()) {
throw new IllegalStateException("Dictionary resource " + r + " not found");
}
out.write('\n');
} while (urls.hasMoreElements());
do {
DefinedFuzzTarget.writeResourceDictionaryPrefix(out, r);
try (InputStream in = urls.nextElement().openStream()) {
in.transferTo(out);
}
out.write('\n');
} while (urls.hasMoreElements());
}
}
}

Expand Down Expand Up @@ -129,7 +131,7 @@ public void fuzz() {
* Reproduce a crash with the given data in this JVM, for easy debugging.
*
* @param path Path to the data that leads to the crash
* @see #reproduce(byte[])
* @see #reproduce(byte[])
*/
public void reproduce(@NonNull Path path) {
try {
Expand Down

0 comments on commit 19780a2

Please sign in to comment.