Browse code

avcodec/samidec: check av_strdup() return value

In function sami_paragraph_to_ass(), the return value of av_strdup() is
not checked. To avoid potential NULL dereference, the return value
should be checked against NULL.

Signed-off-by: Pan Bian <bianpan2016@163.com>

Pan Bian authored on 2017/11/27 15:56:32
Showing 1 changed files
... ...
@@ -48,6 +48,9 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src)
48 48
     AVBPrint *dst_content = &sami->encoded_content;
49 49
     AVBPrint *dst_source = &sami->encoded_source;
50 50
 
51
+    if (!dupsrc)
52
+        return AVERROR(ENOMEM);
53
+
51 54
     av_bprint_clear(&sami->encoded_content);
52 55
     av_bprint_clear(&sami->content);
53 56
     av_bprint_clear(&sami->encoded_source);