Skip to content

Commit da91bf0

Browse files
committed
PDFBOX-5954: scare users less when encountering stream length 0
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1924290 13f79535-47bb-0310-9956-ffa450edef68
1 parent b9241af commit da91bf0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,10 +887,15 @@ private long readUntilEndStream(final EndstreamFilterStream out) throws IOExcept
887887
private boolean validateStreamLength(long streamLength) throws IOException
888888
{
889889
long originOffset = source.getPosition();
890-
if (streamLength <= 0)
890+
if (streamLength == 0)
891891
{
892-
LOG.warn("Invalid stream length: " + streamLength + ", stream start position: "
893-
+ originOffset);
892+
// This may be valid (PDFBOX-5954), or not (PDFBOX-5880)
893+
LOG.debug("Suspicious stream length 0, start position: {}", originOffset);
894+
return false;
895+
}
896+
else if (streamLength <= 0)
897+
{
898+
LOG.warn("Invalid stream length: {}, start position: {}", streamLength, originOffset);
894899
return false;
895900
}
896901
long expectedEndOfStream = originOffset + streamLength;

0 commit comments

Comments
 (0)