pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1861589 - in /pdfbox/trunk: ./ fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java
Date Tue, 18 Jun 2019 16:21:26 GMT
Author: lehmi
Date: Tue Jun 18 16:21:26 2019
New Revision: 1861589

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

Modified:
    pdfbox/trunk/   (props changed)
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java

Propchange: pdfbox/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 18 16:21:26 2019
@@ -1,3 +1,4 @@
 /pdfbox/branches/2.0:1760418,1761484,1762133,1763609,1779822,1780783,1780789,1782684,1784450,1792784,1795704,1795712,1799081-1799082,1814046,1814285,1814459,1824914,1825811,1825820,1825912,1844477,1844516,1844519,1844567,1850577,1857953,1858696,1858698,1860825
+/pdfbox/branches/issue4569:1861285,1861586
 /pdfbox/branches/no-awt:1618517-1621410
 /pdfbox/no-awt:1618514-1618516

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java?rev=1861589&r1=1861588&r2=1861589&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java Tue Jun 18
16:21:26 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