changeset 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 1076f50ba2d2
children dc3406eef251
files libmpcodecs/vd_vfw.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
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);