changeset 32481:983577adcf0e

Fix possible out-of-bounds access.
author reimar
date Sat, 30 Oct 2010 15:29:20 +0000
parents 60453d752380
children cc24ebf93de4
files libvo/vo_directx.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_directx.c	Sat Oct 30 10:15:13 2010 +0000
+++ b/libvo/vo_directx.c	Sat Oct 30 15:29:20 2010 +0000
@@ -229,11 +229,11 @@
     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);