< prev index next >
src/java.desktop/share/classes/sun/font/CMap.java
Print this page
rev 60064 : 8248802: Add log helper methods to FontUtilities.java
*** 398,411 ****
if (subtableFormat < 8) {
subtableLength = buffer.getChar(offset+2);
} else {
subtableLength = buffer.getInt(offset+4) & INTMASK;
}
! if (offset+subtableLength > buffer.capacity()) {
! if (FontUtilities.isLogging()) {
! FontUtilities.getLogger().warning("Cmap subtable overflows buffer.");
! }
}
switch (subtableFormat) {
case 0: return new CMapFormat0(buffer, offset);
case 2: return new CMapFormat2(buffer, offset, xlat);
case 4: return new CMapFormat4(buffer, offset, xlat);
--- 398,409 ----
if (subtableFormat < 8) {
subtableLength = buffer.getChar(offset+2);
} else {
subtableLength = buffer.getInt(offset+4) & INTMASK;
}
! if (FontUtilities.isLogging() && offset + subtableLength > buffer.capacity()) {
! FontUtilities.logWarning("Cmap subtable overflows buffer.");
}
switch (subtableFormat) {
case 0: return new CMapFormat0(buffer, offset);
case 2: return new CMapFormat2(buffer, offset, xlat);
case 4: return new CMapFormat4(buffer, offset, xlat);
*** 420,434 ****
private void createUVS(ByteBuffer buffer, int offset) {
int subtableFormat = buffer.getChar(offset);
if (subtableFormat == 14) {
long subtableLength = buffer.getInt(offset + 2) & INTMASK;
! if (offset + subtableLength > buffer.capacity()) {
! if (FontUtilities.isLogging()) {
! FontUtilities.getLogger()
! .warning("Cmap UVS subtable overflows buffer.");
! }
}
try {
this.uvs = new UVS(buffer, offset);
} catch (Throwable t) {
t.printStackTrace();
--- 418,429 ----
private void createUVS(ByteBuffer buffer, int offset) {
int subtableFormat = buffer.getChar(offset);
if (subtableFormat == 14) {
long subtableLength = buffer.getInt(offset + 2) & INTMASK;
! if (FontUtilities.isLogging() && offset + subtableLength > buffer.capacity()) {
! FontUtilities.logWarning("Cmap UVS subtable overflows buffer.");
}
try {
this.uvs = new UVS(buffer, offset);
} catch (Throwable t) {
t.printStackTrace();
< prev index next >