summaryrefslogtreecommitdiff
path: root/libavformat/webvttenc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-04-04 10:41:59 +0200
committerAnton Khirnov <anton@khirnov.net>2021-04-08 11:03:15 +0200
commit9168a1c0e67b5c31727b12329b6f52d2bb5e0a14 (patch)
treed6b2a4ac17fb01f26264e6154f8036350277f2af /libavformat/webvttenc.c
parent2822bfbbfbc7a0013849758cc557226d48956424 (diff)
downloadffmpeg-9168a1c0e67b5c31727b12329b6f52d2bb5e0a14.tar.gz
lavf/webvttenc: fix avio_printf argument types after bump
Field precision supplied with the '*' specification must be an int.
Diffstat (limited to 'libavformat/webvttenc.c')
-rw-r--r--libavformat/webvttenc.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c
index 552bc38b65..809fead69f 100644
--- a/libavformat/webvttenc.c
+++ b/libavformat/webvttenc.c
@@ -65,6 +65,7 @@ static int webvtt_write_packet(AVFormatContext *ctx, AVPacket *pkt)
{
AVIOContext *pb = ctx->pb;
buffer_size_t id_size, settings_size;
+ int id_size_int, settings_size_int;
uint8_t *id, *settings;
avio_printf(pb, "\n");
@@ -72,8 +73,12 @@ static int webvtt_write_packet(AVFormatContext *ctx, AVPacket *pkt)
id = av_packet_get_side_data(pkt, AV_PKT_DATA_WEBVTT_IDENTIFIER,
&id_size);
- if (id && id_size > 0)
- avio_printf(pb, "%.*s\n", id_size, id);
+ if (id_size > INT_MAX)
+ return AVERROR(EINVAL);
+
+ id_size_int = id_size;
+ if (id && id_size_int > 0)
+ avio_printf(pb, "%.*s\n", id_size_int, id);
webvtt_write_time(pb, pkt->pts);
avio_printf(pb, " --> ");
@@ -82,8 +87,12 @@ static int webvtt_write_packet(AVFormatContext *ctx, AVPacket *pkt)
settings = av_packet_get_side_data(pkt, AV_PKT_DATA_WEBVTT_SETTINGS,
&settings_size);
- if (settings && settings_size > 0)
- avio_printf(pb, " %.*s", settings_size, settings);
+ if (settings_size_int > INT_MAX)
+ return AVERROR(EINVAL);
+
+ settings_size_int = settings_size;
+ if (settings && settings_size_int > 0)
+ avio_printf(pb, " %.*s", settings_size_int, settings);
avio_printf(pb, "\n");