lavc/dvdsubenc: check the type of rectangles.

Avoid a crash if a text rectangle is provided.
Fix the segfault reported in trac ticket #1661.
This commit is contained in:
Nicolas George 2012-08-19 19:10:48 +02:00
parent 12b1512e85
commit de60880543

View File

@ -256,6 +256,11 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
if (rects == 0 || h->rects == NULL) if (rects == 0 || h->rects == NULL)
return AVERROR(EINVAL); 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]; vrect = *h->rects[0];
if (rects > 1) { if (rects > 1) {