pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1861586 - /pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java
Date Tue, 18 Jun 2019 16:18:40 GMT
Author: lehmi
Date: Tue Jun 18 16:18:39 2019
New Revision: 1861586

URL: http://svn.apache.org/viewvc?rev=1861586&view=rev
Log:
PDFBOX-4550: don't skip bfranges with more than 255 array elements

Modified:
    pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java

Modified: pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java?rev=1861586&r1=1861585&r2=1861586&view=diff
==============================================================================
--- pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java
(original)
+++ pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java
Tue Jun 18 16:18:39 2019
@@ -359,8 +359,7 @@ public class CMapParser
             int start = CMap.toInt(startCode, startCode.length);
             int end = CMap.toInt(endCode, endCode.length);
             // end has to be bigger than start or equal
-            // the range can not represent more that 255 values
-            if (end < start || (end - start) > 255)
+            if (end < start)
             {
                 // PDFBOX-4550: likely corrupt stream
                 break;
@@ -378,6 +377,12 @@ public class CMapParser
             // PDFBOX-3807: ignore null
             else if (nextToken instanceof byte[])
             {
+                // the range can not represent more that 255 values
+                if ((end - start) > 255)
+                {
+                    // PDFBOX-4550: likely corrupt stream
+                    break;
+                }
                 byte[] tokenBytes = (byte[]) nextToken;
                 // PDFBOX-3450: ignore <>
                 if (tokenBytes.length > 0)



Mime
View raw message