Skip to content

Commit

Permalink
Fix JANDEX-33 Infinite loop on corrupted class file in JAR stream
Browse files Browse the repository at this point in the history
  • Loading branch information
n1hility committed Jul 20, 2015
1 parent b5c334c commit f52aa53
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/org/jboss/jandex/Indexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ private static void skipFully(InputStream s, long n) throws IOException {
if (skipped < 0)
throw new EOFException();
total += skipped;

// Skip is not guaranteed to distinguish between EOF and nothing-read
if (skipped == 0) {
if (s.read() < 0) {
throw new EOFException();
}
total++;
}
}
}

Expand Down

0 comments on commit f52aa53

Please sign in to comment.