History

avcodec/assenc: Use size_t for length of string

Andreas Rheinhardt committed 2 years ago

Commit b8a00a11 parent fe080581 file · +2 −2Browse files

Unified · Split

libavcodec/assenc.c+2−2
@@ -45,7 +45,7 @@ static int ass_encode_frame(AVCodecContext *avctx, · 44 unmodified lines
4545 unsigned char *buf, int bufsize,
4646 const AVSubtitle *sub)
4747 {
48− int len;
48+ size_t len;
4949
5050 if (sub->num_rects != 1) {
5151 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, · 7 unmodified lines
5959
6060 len = av_strlcpy(buf, sub->rects[0]->ass, bufsize);
6161
62− if (len > bufsize - 1) {
62+ if (len >= bufsize) {
6363 av_log(avctx, AV_LOG_ERROR, "Buffer too small for ASS event.\n");
6464 return AVERROR_BUFFER_TOO_SMALL;
6565 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t