You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2013/04/18 22:46:53 UTC
svn commit: r1469558 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
Author: lehmi
Date: Thu Apr 18 20:46:53 2013
New Revision: 1469558
URL: http://svn.apache.org/r1469558
Log:
PDFBOX-1561: use only space and carriage return as white space character when parsing an inline image
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java?rev=1469558&r1=1469557&r2=1469558&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java Thu Apr 18 20:46:53 2013
@@ -401,10 +401,11 @@ public class PDFStreamParser extends Bas
//(UnderstandingWebSphereClassLoaders.pdf) which has EI as part
//of the image data and will stop parsing prematurely if there is
//not a check for <whitespace>EI<whitespace>.
- while( !(isWhitespace( twoBytesAgo ) &&
+ // Not all whitespaces are allowed here. see PDFBOX1561
+ while( !(isSpaceOrReturn( twoBytesAgo ) &&
lastByte == 'E' &&
currentByte == 'I' &&
- isWhitespace() //&&
+ isSpaceOrReturn() //&&
//amyuni2_05d__pdf1_3_acro4x.pdf has image data that
//is compressed, so expectedBytes is useless here.
//count >= expectedBytes
@@ -489,4 +490,16 @@ public class PDFStreamParser extends Bas
}
return buffer.toString();
}
+
+
+ private boolean isSpaceOrReturn( int c )
+ {
+ return c == 13 || c == 32;
+ }
+
+ private boolean isSpaceOrReturn() throws IOException
+ {
+ return isSpaceOrReturn( pdfSource.peek() );
+ }
+
}