提交 4bd5cf87 编写于 作者: B bae

6999620: [parfait] potential buffer overruns in 2d and awt

Reviewed-by: jgodinez, prr
上级 fe79836e
......@@ -396,7 +396,7 @@ Java_sun_java2d_d3d_D3DGraphicsDevice_enumDisplayModesNative
UINT adapter;
// EnumAdapterModes treats 555 and 565 formats as equivalents
static D3DFORMAT formats[] =
{ D3DFMT_X8R8G8B8, D3DFMT_R5G6B5 };
{ D3DFMT_X8R8G8B8, D3DFMT_R5G6B5 };
J2dTraceLn(J2D_TRACE_INFO, "D3DGD_enumDisplayModesNative");
......@@ -404,7 +404,7 @@ Java_sun_java2d_d3d_D3DGraphicsDevice_enumDisplayModesNative
RETURN_IF_NULL(pd3d9 = pMgr->GetD3DObject());
adapter = pMgr->GetAdapterOrdinalForScreen(gdiScreen);
for (formatNum = 0; formatNum < 3; formatNum++) {
for (formatNum = 0; formatNum < (sizeof formats)/(sizeof *formats); formatNum++) {
modesCount = pd3d9->GetAdapterModeCount(adapter, formats[formatNum]);
for (modeNum = 0; modeNum < modesCount; modeNum++) {
if (SUCCEEDED(pd3d9->EnumAdapterModes(adapter, formats[formatNum],
......
......@@ -2491,7 +2491,7 @@ Java_sun_awt_windows_WToolkit_loadSystemColors(JNIEnv *env, jobject self,
jint* colorsPtr = NULL;
try {
colorsPtr = (jint *)env->GetPrimitiveArrayCritical(colors, 0);
for (int i = 0; i < sizeof indexMap && i < colorLen; i++) {
for (int i = 0; i < (sizeof indexMap)/(sizeof *indexMap) && i < colorLen; i++) {
colorsPtr[i] = DesktopColor2RGB(indexMap[i]);
}
} catch (...) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册