You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2020/04/13 20:14:43 UTC
svn commit: r1876463 -
/pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java
Author: tilman
Date: Mon Apr 13 20:14:43 2020
New Revision: 1876463
URL: http://svn.apache.org/viewvc?rev=1876463&view=rev
Log:
PDFBOX-4811: reposition after first read byte if didn't get a match after having read many
Modified:
pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java
Modified: pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java?rev=1876463&r1=1876462&r2=1876463&view=diff
==============================================================================
--- pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java (original)
+++ pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java Mon Apr 13 20:14:43 2020
@@ -109,6 +109,7 @@ public class CMap
{
byte[] bytes = new byte[maxCodeLength];
in.read(bytes,0,minCodeLength);
+ in.mark(maxCodeLength);
for (int i = minCodeLength-1; i < maxCodeLength; i++)
{
final int byteCount = i+1;
@@ -130,6 +131,16 @@ public class CMap
seq += String.format("0x%02X (%04o) ", bytes[i], bytes[i]);
}
LOG.warn("Invalid character code sequence " + seq + "in CMap " + cmapName);
+ // PDFBOX-4811 reposition after first byte
+ if (in.markSupported())
+ {
+ in.reset();
+ }
+ else
+ {
+ LOG.warn("mark() and reset() not supported, " + (maxCodeLength - 1) +
+ " bytes have been skipped");
+ }
return 0;
}