[FFmpeg-devel] [PATCH 07/17] avcodec/srtdec: add some memory checks

Clément Bœsch u at pkh.me
Sat Sep 20 22:27:47 CEST 2014


---
 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;
-- 
2.1.0



More information about the ffmpeg-devel mailing list