[FFmpeg-devel] [PATCH 2/2] dv: dont crash in dv_frame_offset if avpriv_dv_codec_profile returns NULL

Marton Balint cus at passwd.hu
Sun Dec 25 19:31:24 CET 2011


Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavformat/dv.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libavformat/dv.c b/libavformat/dv.c
index 5dddaf6..b4d874c 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -34,6 +34,7 @@
 #include "libavcodec/dvdata.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
+#include "libavutil/avassert.h"
 #include "dv.h"
 
 struct DVDemuxContext {
@@ -373,7 +374,10 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
     const DVprofile* sys = avpriv_dv_codec_profile(c->vst->codec);
     int64_t offset;
     int64_t size = avio_size(s->pb) - s->data_offset;
-    int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
+    int64_t max_offset;
+
+    av_assert0(sys);
+    max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
 
     offset = sys->frame_size * timestamp;
 
-- 
1.7.3.4



More information about the ffmpeg-devel mailing list