[FFmpeg-devel] [PATCH] lavc/dvdsubenc: check the type of rectangles.

Nicolas George nicolas.george at normalesup.org
Sun Aug 19 19:11:47 CEST 2012


Avoid a crash if a text rectangle is provided.
Fix the segfault reported in trac ticket #1661.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavcodec/dvdsubenc.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
index c87f336..d913708 100644
--- a/libavcodec/dvdsubenc.c
+++ b/libavcodec/dvdsubenc.c
@@ -256,6 +256,11 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
 
     if (rects == 0 || h->rects == NULL)
         return AVERROR(EINVAL);
+    for (i = 0; i < rects; i++)
+        if (h->rects[i]->type != SUBTITLE_BITMAP) {
+            av_log(avctx, AV_LOG_ERROR, "Bitmap subtitle required\n");
+            return AVERROR(EINVAL);
+        }
     vrect = *h->rects[0];
 
     if (rects > 1) {
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list