diff --git a/openpdf/src/main/java/com/lowagie/text/Jpeg.java b/openpdf/src/main/java/com/lowagie/text/Jpeg.java index d8111977f..3ae6692f7 100644 --- a/openpdf/src/main/java/com/lowagie/text/Jpeg.java +++ b/openpdf/src/main/java/com/lowagie/text/Jpeg.java @@ -241,7 +241,10 @@ private void processParameters() throws BadElementException, IOException { throw new IOException(MessageLocalization.getComposedMessage("premature.eof.while.reading.jpg")); } if (v == 0xFF) { - int marker = is.read(); + int marker; + do { + marker = is.read(); + } while (marker == 0xFF); // Skip extra FF bytes, per JPEG spec B.1.1.2 if (firstPass && marker == M_APP0) { firstPass = false; len = getShort(is);