Author: lehmi Date: Sat Apr 1 14:57:29 2023 New Revision: 1908902 URL: http://svn.apache.org/viewvc?rev=1908902&view=rev Log: PDFBOX-5178: add LF-combinations to checkForEndOfString
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java?rev=1908902&r1=1908901&r2=1908902&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java Sat Apr 1 14:57:29 2023 @@ -415,12 +415,18 @@ public abstract class BaseParser // The following cases are valid indicators for the end of the string // 1. Next line contains another COSObject: CR + LF + '/' // 2. COSDictionary ends in the next line: CR + LF + '>' - // 3. Next line contains another COSObject: CR + '/' - // 4. COSDictionary ends in the next line: CR + '>' - if (amountRead == 3 && nextThreeBytes[0] == ASCII_CR) + // 3. Next line contains another COSObject: LF + '/' + // 4. COSDictionary ends in the next line: LF + '>' + // 5. Next line contains another COSObject: CR + '/' + // 6. COSDictionary ends in the next line: CR + '>' + if (amountRead == 3) { - if ( (nextThreeBytes[1] == ASCII_LF && (nextThreeBytes[2] == '/') || nextThreeBytes[2] == '>') - || nextThreeBytes[1] == '/' || nextThreeBytes[1] == '>') + if ((nextThreeBytes[0] == ASCII_CR || nextThreeBytes[0] == ASCII_LF + && (nextThreeBytes[1] == '/' || nextThreeBytes[1] == '>')) // + || // + (nextThreeBytes[0] == ASCII_CR && nextThreeBytes[1] == ASCII_LF + && nextThreeBytes[2] == '/' && nextThreeBytes[2] == '>') // + ) { braces = 0; }