[FFmpeg-cvslog] lavc: make avcodec_decode_subtitle2 more robust

Marton Balint git at videolan.org
Sun Oct 20 21:15:57 CEST 2013


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sun Oct 20 18:24:55 2013 +0200| [b2d9790c2ba75b5e5ac5194042f4175cb66cc0e0] | committer: Michael Niedermayer

lavc: make avcodec_decode_subtitle2 more robust

Signed-off-by: Marton Balint <cus at passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/utils.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 162d61d..37d6ee3 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2338,6 +2338,12 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
 {
     int i, ret = 0;
 
+    if (!avpkt->data && avpkt->size) {
+        av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n");
+        return AVERROR(EINVAL);
+    }
+    if (!avctx->codec)
+        return AVERROR(EINVAL);
     if (avctx->codec->type != AVMEDIA_TYPE_SUBTITLE) {
         av_log(avctx, AV_LOG_ERROR, "Invalid media type for subtitles\n");
         return AVERROR(EINVAL);



More information about the ffmpeg-cvslog mailing list