[MPlayer-dev-eng] [PATCH] Fix uninitialized memory read in vd_ffmpeg.c

Tobias Diedrich ranma at tdiedrich.de
Thu Mar 10 13:29:47 CET 2011


Ivan Kalvachev wrote:
> Is there some reason to output it as 32bit numbers?
> If I understand correctly it holds bitstream data.
> It would be much simpler if it is output as bytes.

I don't see any particular reason.  I just didn't want to change the
existing format.

This outputs it as bytes, so instead of:
vd_ffmpeg data: b0010000, 1000001, 1389b5, 0100
vd_ffmpeg data: b6010000, da33f050, 3fadd5c1, 3b4cfdff
vd_ffmpeg data: b6010000, da236051, 2b8b76c3, a7736662

you get:
vd_ffmpeg data: 00 00 01 b0 01 00 00 01 b5 89 13 00 00 01 00 00 
vd_ffmpeg data: 00 00 01 b6 50 f0 33 da c1 d5 ad 3f ff fd 4c 3b 
vd_ffmpeg data: 00 00 01 b6 51 60 23 da c3 76 8b 2b 62 66 73 a7 

Index: mplayer-patchset1/libmpcodecs/vd_ffmpeg.c
===================================================================
--- mplayer-patchset1.orig/libmpcodecs/vd_ffmpeg.c	2011-02-21 15:28:33.649719000 +0100
+++ mplayer-patchset1/libmpcodecs/vd_ffmpeg.c	2011-03-10 13:09:12.098977000 +0100
@@ -828,8 +828,15 @@
 
     avctx->hurry_up=(flags&3)?((flags&2)?2:1):0;
 
-    mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "vd_ffmpeg data: %04x, %04x, %04x, %04x\n",
-           ((int *)data)[0], ((int *)data)[1], ((int *)data)[2], ((int *)data)[3]);
+    if (mp_msg_test(MSGT_DECVIDEO, MSGL_DBG2)) {
+        const int n_max = 16;
+        int i, n = len > n_max ? n_max : len;
+        mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "vd_ffmpeg data: ");
+        for (i=0; i<n; i++)
+            mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "%02x ", ((uint8_t*)data)[i]);
+        mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "\n");
+    }
+
     av_init_packet(&pkt);
     pkt.data = data;
     pkt.size = len;

-- 
Tobias						PGP: http://8ef7ddba.uguu.de


More information about the MPlayer-dev-eng mailing list