assdec: avoid a possible NULL dereference.
authorNicolas George <nicolas.george@normalesup.org>
Wed, 29 Feb 2012 12:46:13 +0000 (13:46 +0100)
committerNicolas George <nicolas.george@normalesup.org>
Wed, 7 Mar 2012 15:41:30 +0000 (16:41 +0100)
libavcodec/assdec.c

index c5f9cab..47ea330 100644 (file)
@@ -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;