Skip to content

Commit

Permalink
Port ebc4912: Prevent overflow while offsets writing.
Browse files Browse the repository at this point in the history
DEV-1885
  • Loading branch information
ars18wrw committed Aug 15, 2017
1 parent 04f38fc commit 9bef56e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions itext/src/main/java/com/itextpdf/text/pdf/CFFFontSubset.java
Original file line number Diff line number Diff line change
Expand Up @@ -1043,9 +1043,9 @@ protected byte[] AssembleIndex(int[] NewOffsets,byte[] NewObjects)
int Size = NewOffsets[NewOffsets.length-1];
// Calc the Offsize
byte Offsize;
if (Size <= 0xff) Offsize = 1;
else if (Size <= 0xffff) Offsize = 2;
else if (Size <= 0xffffff) Offsize = 3;
if (Size < 0xff) Offsize = 1;
else if (Size < 0xffff) Offsize = 2;
else if (Size < 0xffffff) Offsize = 3;
else Offsize = 4;
// The byte array for the new index. The size is calc by
// Count=2, Offsize=1, OffsetArray = Offsize*(Count+1), The object array
Expand Down

0 comments on commit 9bef56e

Please sign in to comment.