8074098: 2D_Font/Bug8067699 test fails with SIGBUS crash on Solaris Sparc

Reviewed-by: bae, srl, mschoene
This commit is contained in:
Phil Race 2015-03-10 14:00:05 -07:00
parent 53a74d7f41
commit aadda7f118
2 changed files with 16 additions and 0 deletions

View File

@ -54,6 +54,10 @@ void MorphTableHeader::process(const LETableReference &base, LEGlyphStorage &gly
for (chain = 0; LE_SUCCESS(success) && (chain < chainCount); chain += 1) { for (chain = 0; LE_SUCCESS(success) && (chain < chainCount); chain += 1) {
if (chain > 0) { if (chain > 0) {
le_uint32 chainLength = SWAPL(chainHeader->chainLength); le_uint32 chainLength = SWAPL(chainHeader->chainLength);
if (chainLength & 0x03) { // incorrect alignment for 32 bit tables
success = LE_MEMORY_ALLOCATION_ERROR; // as good a choice as any
return;
}
chainHeader.addOffset(chainLength, success); chainHeader.addOffset(chainLength, success);
} }
FeatureFlags defaultFlags = SWAPL(chainHeader->defaultFlags); FeatureFlags defaultFlags = SWAPL(chainHeader->defaultFlags);
@ -66,6 +70,10 @@ void MorphTableHeader::process(const LETableReference &base, LEGlyphStorage &gly
for (subtable = 0; LE_SUCCESS(success) && (subtable < nSubtables); subtable += 1) { for (subtable = 0; LE_SUCCESS(success) && (subtable < nSubtables); subtable += 1) {
if (subtable > 0) { if (subtable > 0) {
le_int16 length = SWAPW(subtableHeader->length); le_int16 length = SWAPW(subtableHeader->length);
if (length & 0x03) { // incorrect alignment for 32 bit tables
success = LE_MEMORY_ALLOCATION_ERROR; // as good a choice as any
return;
}
subtableHeader.addOffset(length, success); subtableHeader.addOffset(length, success);
} }
SubtableCoverage coverage = SWAPW(subtableHeader->coverage); SubtableCoverage coverage = SWAPW(subtableHeader->coverage);

View File

@ -59,6 +59,10 @@ void MorphTableHeader2::process(const LEReferenceTo<MorphTableHeader2> &base, LE
for (chain = 0; LE_SUCCESS(success) && (chain < chainCount); chain++) { for (chain = 0; LE_SUCCESS(success) && (chain < chainCount); chain++) {
if (chain>0) { if (chain>0) {
le_uint32 chainLength = SWAPL(chainHeader->chainLength); le_uint32 chainLength = SWAPL(chainHeader->chainLength);
if (chainLength & 0x03) { // incorrect alignment for 32 bit tables
success = LE_MEMORY_ALLOCATION_ERROR; // as good a choice as any
return;
}
chainHeader.addOffset(chainLength, success); // Don't increment the first time chainHeader.addOffset(chainLength, success); // Don't increment the first time
} }
FeatureFlags flag = SWAPL(chainHeader->defaultFlags); FeatureFlags flag = SWAPL(chainHeader->defaultFlags);
@ -188,6 +192,10 @@ void MorphTableHeader2::process(const LEReferenceTo<MorphTableHeader2> &base, LE
for (subtable = 0; LE_SUCCESS(success) && subtable < nSubtables; subtable++) { for (subtable = 0; LE_SUCCESS(success) && subtable < nSubtables; subtable++) {
if(subtable>0) { if(subtable>0) {
le_uint32 length = SWAPL(subtableHeader->length); le_uint32 length = SWAPL(subtableHeader->length);
if (length & 0x03) { // incorrect alignment for 32 bit tables
success = LE_MEMORY_ALLOCATION_ERROR; // as good a choice as any
return;
}
subtableHeader.addOffset(length, success); // Don't addOffset for the last entry. subtableHeader.addOffset(length, success); // Don't addOffset for the last entry.
} }
le_uint32 coverage = SWAPL(subtableHeader->coverage); le_uint32 coverage = SWAPL(subtableHeader->coverage);