[FFmpeg-devel] [PATCH] avformat/srtenc: avoid segmentation fault when transcoding from SSA to SRT

Gilles Chanteperdrix gilles.chanteperdrix at xenomai.org
Sat Mar 7 21:10:16 CET 2015


When transcoding to SRT, do not assume that each sub-title frame contains
text.

Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix at xenomai.org>
---
 libavcodec/srtenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/srtenc.c b/libavcodec/srtenc.c
index 3287970..ab790f8 100644
--- a/libavcodec/srtenc.c
+++ b/libavcodec/srtenc.c
@@ -241,6 +241,9 @@ static int srt_encode_frame(AVCodecContext *avctx,
         for (; dialog && num--; dialog++) {
             s->alignment_applied = 0;
             srt_style_apply(s, dialog->style);
+            if (!dialog->text)
+                    continue;
+
             ff_ass_split_override_codes(&srt_callbacks, s, dialog->text);
         }
     }
-- 
1.8.4



More information about the ffmpeg-devel mailing list