diff libmpcodecs/vd_vfw.c @ 24801:d555579c8c98

Check ICDecompressGetFormatSize to avoid crashes. Based on patch by Gianluigi Tiesi (mplayer netfarm it).
author reimar
date Sun, 21 Oct 2007 13:15:48 +0000
parents beb3c0d1f435
children 9e739bdb049c
line wrap: on
line diff
--- a/libmpcodecs/vd_vfw.c	Sun Oct 21 12:56:22 2007 +0000
+++ b/libmpcodecs/vd_vfw.c	Sun Oct 21 13:15:48 2007 +0000
@@ -172,6 +172,11 @@
 
     o_bih_len = ICDecompressGetFormatSize(priv->handle, sh->bih);
   
+    if(o_bih_len < sizeof(BITMAPINFOHEADER)){
+       mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormatSize returned a bogus value: %d\n", o_bih_len);
+       return 0;
+    }
+
     priv->o_bih = malloc(o_bih_len);
     memset(priv->o_bih, 0, o_bih_len);