Skip to content

Commit

Permalink
Handle invalid RIFF chunk sizes
Browse files Browse the repository at this point in the history
Contributes to #561
  • Loading branch information
drewnoakes committed Apr 3, 2022
1 parent ba095b5 commit 7ae0389
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/com/drew/imaging/riff/RiffReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public void processChunks(SequentialReader reader, int sectionSize, RiffHandler
while (reader.getPosition() < sectionSize) {
String fourCC = new String(reader.getBytes(4));
int size = reader.getInt32();
if (size <= 0) {
handler.addError("Invalid chunk size: " + size);
break;
}
if (fourCC.equals("LIST") || fourCC.equals("RIFF")) {
String listName = new String(reader.getBytes(4));
if (size < 4) {
Expand Down

0 comments on commit 7ae0389

Please sign in to comment.