[FFmpeg-devel] [PATCH 1/8] avcodec/assdec: do not overread if zero padding is missing

Marton Balint cus at passwd.hu
Sat Mar 13 23:33:38 EET 2021


Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavcodec/assdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c
index f0b1069cd2..655fc1365c 100644
--- a/libavcodec/assdec.c
+++ b/libavcodec/assdec.c
@@ -54,7 +54,7 @@ static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,
         return AVERROR(ENOMEM);
     sub->num_rects = 1;
     sub->rects[0]->type = SUBTITLE_ASS;
-    sub->rects[0]->ass  = av_strdup(avpkt->data);
+    sub->rects[0]->ass  = av_strndup(avpkt->data, avpkt->size);
     if (!sub->rects[0]->ass)
         return AVERROR(ENOMEM);
     *got_sub_ptr = 1;
-- 
2.26.2



More information about the ffmpeg-devel mailing list