Skip to content

Commit 09c7517

Browse files
committed
Port ebc4912: Prevent overflow while offsets writing.
DEV-1885
1 parent 68d0201 commit 09c7517

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/core/iTextSharp/text/pdf/CFFFontSubset.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,9 +1040,9 @@ virtual protected byte[] AssembleIndex(int[] NewOffsets,byte[] NewObjects)
10401040
int Size = NewOffsets[NewOffsets.Length-1];
10411041
// Calc the Offsize
10421042
byte Offsize;
1043-
if (Size <= 0xff) Offsize = 1;
1044-
else if (Size <= 0xffff) Offsize = 2;
1045-
else if (Size <= 0xffffff) Offsize = 3;
1043+
if (Size < 0xff) Offsize = 1;
1044+
else if (Size < 0xffff) Offsize = 2;
1045+
else if (Size < 0xffffff) Offsize = 3;
10461046
else Offsize = 4;
10471047
// The byte array for the new index. The size is calc by
10481048
// Count=2, Offsize=1, OffsetArray = Offsize*(Count+1), The object array

0 commit comments

Comments
 (0)