[FFmpeg-cvslog] dvdec: check ipcm more completely, avoid assert failure.

Michael Niedermayer git at videolan.org
Tue Nov 13 21:57:31 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Nov 13 19:37:47 2012 +0100| [3669915e93b3df63034857534245c3f2575d78ff] | committer: Michael Niedermayer

dvdec: check ipcm more completely, avoid assert failure.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3669915e93b3df63034857534245c3f2575d78ff
---

 libavformat/dv.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/dv.c b/libavformat/dv.c
index f3d88e4..a04735a 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -142,6 +142,11 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4],
      * channels 0,1 and odd 2,3. */
     ipcm = (sys->height == 720 && !(frame[1] & 0x0C)) ? 2 : 0;
 
+    if (ipcm + sys->n_difchan > (quant == 1 ? 2 : 4)) {
+        av_log(NULL, AV_LOG_ERROR, "too many dv pcm frames\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     /* for each DIF channel */
     for (chan = 0; chan < sys->n_difchan; chan++) {
         av_assert0(ipcm<4);



More information about the ffmpeg-cvslog mailing list