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 add7e1d commit b7c1857
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 @@ -126,6 +126,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 b7c1857

Please sign in to comment.