提交 cab1835f 编写于 作者: P prr

8034267: Probabilistic native crash

Reviewed-by: bae, serb, mschoene
上级 6d57d1cf
...@@ -177,18 +177,10 @@ static unsigned long ReadTTFontFileFunc(FT_Stream stream, ...@@ -177,18 +177,10 @@ static unsigned long ReadTTFontFileFunc(FT_Stream stream,
if (numBytes > FILEDATACACHESIZE) { if (numBytes > FILEDATACACHESIZE) {
bBuffer = (*env)->NewDirectByteBuffer(env, destBuffer, numBytes); bBuffer = (*env)->NewDirectByteBuffer(env, destBuffer, numBytes);
if (bBuffer != NULL) { if (bBuffer != NULL) {
/* Loop until the read succeeds (or EOF). bread = (*env)->CallIntMethod(env,
* This should improve robustness in the event of a problem in scalerInfo->font2D,
* the I/O system. If we find that we ever end up spinning here sunFontIDs.ttReadBlockMID,
* we are going to have to do some serious work to recover. bBuffer, offset, numBytes);
* Just returning without reading the data will cause a crash.
*/
while (bread == 0) {
bread = (*env)->CallIntMethod(env,
scalerInfo->font2D,
sunFontIDs.ttReadBlockMID,
bBuffer, offset, numBytes);
}
return bread; return bread;
} else { } else {
/* We probably hit bug bug 4845371. For reasons that /* We probably hit bug bug 4845371. For reasons that
...@@ -224,19 +216,10 @@ static unsigned long ReadTTFontFileFunc(FT_Stream stream, ...@@ -224,19 +216,10 @@ static unsigned long ReadTTFontFileFunc(FT_Stream stream,
(offset + FILEDATACACHESIZE > scalerInfo->fileSize) ? (offset + FILEDATACACHESIZE > scalerInfo->fileSize) ?
scalerInfo->fileSize - offset : FILEDATACACHESIZE; scalerInfo->fileSize - offset : FILEDATACACHESIZE;
bBuffer = scalerInfo->directBuffer; bBuffer = scalerInfo->directBuffer;
/* Loop until all the read succeeds (or EOF). bread = (*env)->CallIntMethod(env, scalerInfo->font2D,
* This should improve robustness in the event of a problem in sunFontIDs.ttReadBlockMID,
* the I/O system. If we find that we ever end up spinning here bBuffer, offset,
* we are going to have to do some serious work to recover. scalerInfo->fontDataLength);
* Just returning without reading the data will cause a crash.
*/
while (bread == 0) {
bread = (*env)->CallIntMethod(env, scalerInfo->font2D,
sunFontIDs.ttReadBlockMID,
bBuffer, offset,
scalerInfo->fontDataLength);
}
memcpy(destBuffer, scalerInfo->fontData, numBytes); memcpy(destBuffer, scalerInfo->fontData, numBytes);
return numBytes; return numBytes;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册