lavc/ass: error if not passed exactly 1 rect
This never produced valid output.
This commit is contained in:
parent
b68a6ba469
commit
c0d9327a63
@ -45,27 +45,26 @@ static int ass_encode_frame(AVCodecContext *avctx,
|
|||||||
unsigned char *buf, int bufsize,
|
unsigned char *buf, int bufsize,
|
||||||
const AVSubtitle *sub)
|
const AVSubtitle *sub)
|
||||||
{
|
{
|
||||||
int i, len, total_len = 0;
|
int len;
|
||||||
|
|
||||||
for (i=0; i<sub->num_rects; i++) {
|
if (sub->num_rects != 1) {
|
||||||
const char *ass = sub->rects[i]->ass;
|
av_log(avctx, AV_LOG_ERROR, "Only one rect per AVSubtitle is supported in ASS.\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
if (sub->rects[i]->type != SUBTITLE_ASS) {
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n");
|
|
||||||
return AVERROR(EINVAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
len = av_strlcpy(buf+total_len, ass, bufsize-total_len);
|
|
||||||
|
|
||||||
if (len > bufsize-total_len-1) {
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "Buffer too small for ASS event.\n");
|
|
||||||
return AVERROR_BUFFER_TOO_SMALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
total_len += len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return total_len;
|
if (sub->rects[0]->type != SUBTITLE_ASS) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
len = av_strlcpy(buf, sub->rects[0]->ass, bufsize);
|
||||||
|
|
||||||
|
if (len > bufsize - 1) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Buffer too small for ASS event.\n");
|
||||||
|
return AVERROR_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_SSA_ENCODER
|
#if CONFIG_SSA_ENCODER
|
||||||
|
Loading…
x
Reference in New Issue
Block a user