GlyfSimpleDescript.java (pdfbox-2.0.23-src) | : | GlyfSimpleDescript.java (pdfbox-2.0.24-src) | ||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
*/ | */ | |||
private static final Log LOG = LogFactory.getLog(GlyfSimpleDescript.class); | private static final Log LOG = LogFactory.getLog(GlyfSimpleDescript.class); | |||
private int[] endPtsOfContours; | private int[] endPtsOfContours; | |||
private byte[] flags; | private byte[] flags; | |||
private short[] xCoordinates; | private short[] xCoordinates; | |||
private short[] yCoordinates; | private short[] yCoordinates; | |||
private final int pointCount; | private final int pointCount; | |||
/** | /** | |||
* Constructor for an empty description. | ||||
* | ||||
* @throws IOException is thrown if something went wrong | ||||
*/ | ||||
GlyfSimpleDescript() throws IOException | ||||
{ | ||||
super((short) 0, null); | ||||
pointCount = 0; | ||||
} | ||||
/** | ||||
* Constructor. | * Constructor. | |||
* | * | |||
* @param numberOfContours number of contours | * @param numberOfContours number of contours | |||
* @param bais the stream to be read | * @param bais the stream to be read | |||
* @param x0 the initial X-position | * @param x0 the initial X-position | |||
* @throws IOException is thrown if something went wrong | * @throws IOException is thrown if something went wrong | |||
*/ | */ | |||
GlyfSimpleDescript(short numberOfContours, TTFDataStream bais, short x0) thr ows IOException | GlyfSimpleDescript(short numberOfContours, TTFDataStream bais, short x0) thr ows IOException | |||
{ | { | |||
super(numberOfContours, bais); | super(numberOfContours, bais); | |||
skipping to change at line 208 | skipping to change at line 219 | |||
* The flags are run-length encoded. | * The flags are run-length encoded. | |||
*/ | */ | |||
private void readFlags(int flagCount, TTFDataStream bais) throws IOException | private void readFlags(int flagCount, TTFDataStream bais) throws IOException | |||
{ | { | |||
for (int index = 0; index < flagCount; index++) | for (int index = 0; index < flagCount; index++) | |||
{ | { | |||
flags[index] = (byte) bais.readUnsignedByte(); | flags[index] = (byte) bais.readUnsignedByte(); | |||
if ((flags[index] & REPEAT) != 0) | if ((flags[index] & REPEAT) != 0) | |||
{ | { | |||
int repeats = bais.readUnsignedByte(); | int repeats = bais.readUnsignedByte(); | |||
for (int i = 1; i <= repeats && index + i < flags.length; i++) | for (int i = 1; i <= repeats; i++) | |||
{ | { | |||
if (index + i >= flags.length) | ||||
{ | ||||
LOG.error("repeat count (" + repeats + ") higher than re | ||||
maining space"); | ||||
return; | ||||
} | ||||
flags[index + i] = flags[index]; | flags[index + i] = flags[index]; | |||
} | } | |||
index += repeats; | index += repeats; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 18 lines changed or added |