diff --git a/Source/com/drew/imaging/riff/RiffReader.java b/Source/com/drew/imaging/riff/RiffReader.java index f9c5b1a30..1340b1487 100644 --- a/Source/com/drew/imaging/riff/RiffReader.java +++ b/Source/com/drew/imaging/riff/RiffReader.java @@ -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) {