changeset 21952:58d083ace2f2

vc1 probing code: if sh_video->bih can't be callocated exit
author nicodvb
date Sat, 20 Jan 2007 13:14:09 +0000
parents bd3c871c93d0
children 62bf4204eed4
files libmpdemux/video.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/video.c	Sat Jan 20 13:10:40 2007 +0000
+++ b/libmpdemux/video.c	Sat Jan 20 13:14:09 2007 +0000
@@ -401,6 +401,10 @@
 
    if(mp_vc1_decode_sequence_header(&picture, &videobuffer[4], videobuf_len-4)) {
      sh_video->bih = (BITMAPINFOHEADER *) calloc(1, sizeof(BITMAPINFOHEADER) + videobuf_len);
+     if(sh_video->bih == NULL) {
+       mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Couldn't alloc %d bytes for VC-1 extradata!\n", sizeof(BITMAPINFOHEADER) + videobuf_len);
+       return 0;
+     }
      sh_video->bih->biSize= sizeof(BITMAPINFOHEADER) + videobuf_len;
      memcpy(sh_video->bih + 1, videobuffer, videobuf_len);
      sh_video->bih->biCompression = sh_video->format;