From patchwork Mon Apr 5 11:09:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 26749 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2FD3C44B015 for ; Mon, 5 Apr 2021 14:11:54 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0E9B468A628; Mon, 5 Apr 2021 14:11:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B5CA0689FD9 for ; Mon, 5 Apr 2021 14:11:45 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id EFE1B24068A for ; Mon, 5 Apr 2021 13:11:44 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id zOWh7PiOCMMH for ; Mon, 5 Apr 2021 13:11:41 +0200 (CEST) Received: from libav.khirnov.net (unknown [IPv6:2a00:c500:561:201:b6e1:23d0:924a:11c0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id AB28424042A for ; Mon, 5 Apr 2021 13:11:41 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 7671B3A060A; Mon, 5 Apr 2021 13:11:39 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Apr 2021 13:09:40 +0200 Message-Id: <20210405110952.17679-4-anton@khirnov.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210405110952.17679-1-anton@khirnov.net> References: <20210405110952.17679-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/17] lavf/webvttenc: fix avio_printf argument types after bump X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Field precision supplied with the '*' specification must be an int. --- libavformat/webvttenc.c | 17 +++++++++++++---- 1 file 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");