6999620: [parfait] potential buffer overruns in 2d and awt
Reviewed-by: jgodinez, prr
This commit is contained in:
parent
e1a25da53b
commit
7f68f1c5f4
@ -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 (...) {
|
||||
|
Loading…
Reference in New Issue
Block a user