vo_directx: Fix possible out-of-bounds access

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32568 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2010-10-30 15:29:20 +00:00 committed by Uoti Urpala
parent d067f6a2a0
commit 0142db087b
1 changed files with 2 additions and 2 deletions

View File

@ -224,11 +224,11 @@ static uint32_t Directx_CreateOverlay(uint32_t imgfmt)
HRESULT ddrval;
DDSURFACEDESC2 ddsdOverlay;
uint32_t i=0;
while ( i < NUM_FORMATS +1 && imgfmt != g_ddpf[i].img_format)
while ( i < NUM_FORMATS && imgfmt != g_ddpf[i].img_format)
{
i++;
}
if (!g_lpdd || !g_lpddsPrimary)
if (!g_lpdd || !g_lpddsPrimary || i == NUM_FORMATS)
return 1;
//cleanup
if (g_lpddsOverlay)g_lpddsOverlay->lpVtbl->Release(g_lpddsOverlay);