[FFmpeg-devel] avcodec/samidec: check av_strdup() return value

Pan Bian bianpan2016 at 163.com
Mon Nov 27 02:53:22 EET 2017


From: Pan Bian <bianpan at 163.com>

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 <bianpan at 163.com>
---
 libavcodec/samidec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c
index 2620424..35fcc41 100644
--- a/libavcodec/samidec.c
+++ b/libavcodec/samidec.c
@@ -48,6 +48,9 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src)
     AVBPrint *dst_content = &sami->encoded_content;
     AVBPrint *dst_source = &sami->encoded_source;
 
+	if (!dupsrc)
+		return AVERROR(ENOMEM);
+
     av_bprint_clear(&sami->encoded_content);
     av_bprint_clear(&sami->content);
     av_bprint_clear(&sami->encoded_source);
-- 
1.9.1




More information about the ffmpeg-devel mailing list