Message ID | GV1SPRMB0063354F1027D42120356ED38F522@GV1SPRMB0063.EURP250.PROD.OUTLOOK.COM |
---|---|
State | Accepted |
Commit | b8a00a1f73331af031cbb8d718d6439522896a3f |
Headers | show |
Series | [FFmpeg-devel,1/7] avcodec/assenc: Use size_t for length of string | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Andreas Rheinhardt: > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/assenc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/assenc.c b/libavcodec/assenc.c > index e548b9fd3b..e734522729 100644 > --- a/libavcodec/assenc.c > +++ b/libavcodec/assenc.c > @@ -45,7 +45,7 @@ static int ass_encode_frame(AVCodecContext *avctx, > unsigned char *buf, int bufsize, > const AVSubtitle *sub) > { > - int len; > + size_t len; > > if (sub->num_rects != 1) { > av_log(avctx, AV_LOG_ERROR, "Only one rect per AVSubtitle is supported in ASS.\n"); > @@ -59,7 +59,7 @@ static int ass_encode_frame(AVCodecContext *avctx, > > len = av_strlcpy(buf, sub->rects[0]->ass, bufsize); > > - if (len > bufsize - 1) { > + if (len >= bufsize) { > av_log(avctx, AV_LOG_ERROR, "Buffer too small for ASS event.\n"); > return AVERROR_BUFFER_TOO_SMALL; > } Will apply this patchset tomorrow unless there are objections. - Andreas
diff --git a/libavcodec/assenc.c b/libavcodec/assenc.c index e548b9fd3b..e734522729 100644 --- a/libavcodec/assenc.c +++ b/libavcodec/assenc.c @@ -45,7 +45,7 @@ static int ass_encode_frame(AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub) { - int len; + size_t len; if (sub->num_rects != 1) { av_log(avctx, AV_LOG_ERROR, "Only one rect per AVSubtitle is supported in ASS.\n"); @@ -59,7 +59,7 @@ static int ass_encode_frame(AVCodecContext *avctx, len = av_strlcpy(buf, sub->rects[0]->ass, bufsize); - if (len > bufsize - 1) { + if (len >= bufsize) { av_log(avctx, AV_LOG_ERROR, "Buffer too small for ASS event.\n"); return AVERROR_BUFFER_TOO_SMALL; }
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/assenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)