[FFmpeg-cvslog] avcodec/srtdec: add some memory checks

Clément Bœsch git at videolan.org
Sun Sep 21 18:45:58 CEST 2014


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sat Sep 20 22:14:11 2014 +0200| [592716227c5f8d662b1ef8fb4f5f4a22cfa751c7] | committer: Clément Bœsch

avcodec/srtdec: add some memory checks

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

 libavcodec/srtdec.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c
index b16645a..794a25a 100644
--- a/libavcodec/srtdec.c
+++ b/libavcodec/srtdec.c
@@ -223,7 +223,7 @@ static int srt_decode_frame(AVCodecContext *avctx,
     char buffer[2048];
     const char *ptr = avpkt->data;
     const char *end = avpkt->data + avpkt->size;
-    int size;
+    int size, ret;
     const uint8_t *p = av_packet_get_side_data(avpkt, AV_PKT_DATA_SUBTITLE_POSITION, &size);
 
     if (p && size == 16) {
@@ -252,7 +252,9 @@ static int srt_decode_frame(AVCodecContext *avctx,
         }
         ptr = srt_to_ass(avctx, buffer, buffer+sizeof(buffer), ptr,
                          x1, y1, x2, y2);
-        ff_ass_add_rect(sub, buffer, ts_start, ts_end-ts_start, 0);
+        ret = ff_ass_add_rect(sub, buffer, ts_start, ts_end-ts_start, 0);
+        if (ret < 0)
+            return ret;
     }
 
     *got_sub_ptr = sub->num_rects > 0;



More information about the ffmpeg-cvslog mailing list