[FFmpeg-cvslog] assdec: avoid a possible NULL dereference.

Nicolas George git at videolan.org
Wed Mar 7 16:58:40 CET 2012


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Wed Feb 29 13:46:13 2012 +0100| [e5dd4ae7284bb290d8dc8e9cd3f2e035d1d77cd0] | committer: Nicolas George

assdec: avoid a possible NULL dereference.

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

 libavcodec/assdec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c
index c5f9cab..47ea330 100644
--- a/libavcodec/assdec.c
+++ b/libavcodec/assdec.c
@@ -41,8 +41,11 @@ static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,
     int len, size = avpkt->size;
 
     while (size > 0) {
+        int duration;
         ASSDialog *dialog = ff_ass_split_dialog(avctx->priv_data, ptr, 0, NULL);
-        int duration = dialog->end - dialog->start;
+        if (!dialog)
+            return AVERROR_INVALIDDATA;
+        duration = dialog->end - dialog->start;
         len = ff_ass_add_rect(data, ptr, 0, duration, 1);
         if (len < 0)
             return len;



More information about the ffmpeg-cvslog mailing list