changeset 11329:9165908f87d3

Fixed wrong allocation of the BITMAPINFOHEADER structure which would crash mplayer in some cases.
author mosu
date Thu, 30 Oct 2003 14:50:04 +0000
parents 72707ddeba92
children a974c00c779d
files libmpdemux/demux_mkv.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.cpp	Thu Oct 30 14:39:18 2003 +0000
+++ b/libmpdemux/demux_mkv.cpp	Thu Oct 30 14:50:04 2003 +0000
@@ -2020,12 +2020,12 @@
     BITMAPINFOHEADER *bih;
 
     idesc = NULL;
-    bih = (BITMAPINFOHEADER *)safemalloc(track->private_size);
-    memset(bih, 0, sizeof(BITMAPINFOHEADER));
 
     if (track->ms_compat) {         // MS compatibility mode
       BITMAPINFOHEADER *src;
       src = (BITMAPINFOHEADER *)track->private_data;
+      bih = (BITMAPINFOHEADER *)safemalloc(track->private_size);
+      memset(bih, 0, track->private_size);
       bih->biSize = get_uint32(&src->biSize);
       bih->biWidth = get_uint32(&src->biWidth);
       bih->biHeight = get_uint32(&src->biHeight);
@@ -2042,6 +2042,8 @@
              track->private_size - sizeof(BITMAPINFOHEADER));
 
     } else {
+      bih = (BITMAPINFOHEADER *)safemalloc(sizeof(BITMAPINFOHEADER));
+      memset(bih, 0, sizeof(BITMAPINFOHEADER));
       bih->biSize = sizeof(BITMAPINFOHEADER);
       bih->biWidth = track->v_width;
       bih->biHeight = track->v_height;