From patchwork Fri Oct 6 01:55:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 44167 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7b1d:b0:15d:8365:d4b8 with SMTP id s29csp100595pzh; Thu, 5 Oct 2023 18:54:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3swmwzlWx/qbkxA9cr2i5WtmmtIHiRWUjrcIfmlT1EYwVUtDObOLrtqLZv7sGtfq25w+/ X-Received: by 2002:a17:907:8b8c:b0:9a9:f0e6:904e with SMTP id tb12-20020a1709078b8c00b009a9f0e6904emr3708120ejc.16.1696557273566; Thu, 05 Oct 2023 18:54:33 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gx3-20020a170906f1c300b009a1e1f41394si1207786ejb.209.2023.10.05.18.54.33; Thu, 05 Oct 2023 18:54:33 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=M9djxjLV; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C3FEA68CAEC; Fri, 6 Oct 2023 04:54:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2109.outbound.protection.outlook.com [40.92.66.109]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6B10A68CA01 for ; Fri, 6 Oct 2023 04:54:23 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QMZZry3YVeb0v9THThfMKcdFb9KGaP7u2mPT+LA17pvj8UHBGGM9ingwHRQgy25mnjIO0HQF1yB2E9Zo5MLk1GN5zeYmO9aGMdQnWoURKWsSX1frENkj03WhfPtnYEnBjibnfYKTxCXqZi+pfKDBdRSSrKquIxwwrPqtBzE4zDVDYdDtq0f2nrjydgE0eB270mUQr7kYtoM8Rb41xem0GzdgoebmGAZEk4UtTbMWwnePWBy8VRVuJjoE7PXqd80IXRBFl4lczhho9iUb2HIbQqfC5ciy1t7FjfJKezbZoFvLT6qWpVWBpnAkbE96LTzKKZMHZ4ouDwnFrAz4k8Wuew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7JHmpmjWaw2sie0ByEXBiwyvlNfzI0E/HX7i5emtoFg=; b=UrzpqWNUpLivBO/Lu2+LO1NJGqWy3iKBMGiOtx2ch5m0Zwlrd/9X0eHXukxl67scTnWLOkjVnsD1J/tRoJ/fDK/zBjJ/3mqknOHA7l+0oUQU0tYuhT0c0SledIgCaZ6Kdc7AesvA6+AQfx2hDE5BHj7SF0TMxMSoxFe7hQZJbt7KczZluVkmI/qL05zbLpkOZAmfjtb7xdJ7/aAjAmatFIqfi8iTEqGhFv/NlFem78t3J1Ie0rlYqcKXw/sNZPfz4waoBlXqEGnNhL3iPDtbHk7/7Y9DfPKxlSqMtqjagbrYzcqdlvNS8QDdtgnE68Oy3N6ubRY0C8NM0IgSEpZYew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7JHmpmjWaw2sie0ByEXBiwyvlNfzI0E/HX7i5emtoFg=; b=M9djxjLV92mzY793JQt3yUyS2KcdIiJTfpS/yMMGN4/CuVJAg/HVK7KMOmOt/aUnJkjkTprkfXUdgLZxGWBVJPC0AovZ07GFz8NK+k9QWjpH/YsdWWtAr//OQelaCVcIMXo544RsBwalI9cvdtTHeh3ESbAa5u//qh8pchjC/FK3Ve7YTxzIBgvY+reiBdHGRkB30CByopbacmBSxazDVwkgBklcQf+G0bElOtRbIlK0q1YBS+vUK5Wn29057SLtyS8JVnUcPyiaGbArb2M5gLwWY0kfC26JPo9P9wUyS7OBJtOgUzexuIW+7DUvsh8Mq5W8BdkUk/4WgXscz/mXNw== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0215.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:326::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.28; Fri, 6 Oct 2023 01:54:22 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::5e01:aea5:d3a8:cafa]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::5e01:aea5:d3a8:cafa%3]) with mapi id 15.20.6792.026; Fri, 6 Oct 2023 01:54:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 6 Oct 2023 03:55:31 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [8g4k+qwAG7VdXVIoBK7IWyTHBRKlJNJm] X-ClientProxiedBy: FR4P281CA0174.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b7::20) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20231006015531.651005-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0215:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ce586a6-0336-4045-423e-08dbc60f28f2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v49Gng4RANe7eEzZGkt2B/ib0JUlDEdgKjCxyl5uFrA70CVTgMOScir06OcmgAWPw0UKUjxZhsr/H2cGTM41KkJ8LJnKBLAIhDLboF9+J15AQpDpRbRTQviGYD5Iu6J/aUSqEN2DizNiJaQAAsCJl/cm7kCxNpP4MPxMhGhr/rhUnRbtozV5hgbHPgP3b02MVWXWH+PG6r7XjGLDmWZ6a9DSCKfBSpNFsKMPwOlJIAjnicvNHDDOB1LpFp0UZgZkI2OW93eeCpPUUjRb2US9XtyIVBzBgVinp/ITn7t85gz4crKrFcQd1LiKYD7QdtGP+ccVV5+BZSTIE5xzuRFWqqpE45jIs8caQDu04xUjCCxLDxQU6/59lDXXaLrZDz6kC+whDBDiuBHy4SO/JPIyZ70GePLtvoaNb24swOpcN8QrBHeGT7Fp0MzLNI3bfp1Ssm5/QQ0jbxVASg6FOVytYAg0aa8oHKShD1HHaaDds2hGau5Y3QOIfcxRrMXzqaigQaTgpAAtU89w9Ntk9751Kt9fpLNOj9USA/xCBmho6I3Jd0UgNm4+ygYNTeq/OJ1k8Z3v90BdXImZnGJgZna/PiOQXHIjqalapzFOrziONGBOUf1eOixkqFWyTdpcEfy8 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mxBIvZXTi016g6GCPP3rml4p2B18p35hf4MTZTDljNOqKOgfLDrx3dxkSbVvv3ixKz7/2Xsq6Q1XFX/6FBCiFYdbCcuPdMXlX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8X4Vq+Tlyeyb8tpG5ryc1Vvp8yN0ext5YTTIhHW92s2JyQZ7n3OUKJNDiqXm/1d1ytP3554kIRX6t2uV2BNF4TupKkairiYpmtnBjwEpBWZG X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ce586a6-0336-4045-423e-08dbc60f28f2 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2023 01:54:21.9927 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P250MB0215 Subject: [FFmpeg-devel] [PATCH] avformat/webpenc: Check seeks X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 5JvnSdsGo/03 Addresses the issue reported in ticket #4609. Signed-off-by: Andreas Rheinhardt --- libavformat/webpenc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c index b3f5bdc9b5..fb0cca3922 100644 --- a/libavformat/webpenc.c +++ b/libavformat/webpenc.c @@ -177,8 +177,8 @@ static int webp_write_trailer(AVFormatContext *s) if (w->using_webp_anim_encoder) { if (w->loop) { // Write loop count. - avio_seek(s->pb, 42, SEEK_SET); - avio_wl16(s->pb, w->loop); + if (avio_seek(s->pb, 42, SEEK_SET) == 42) + avio_wl16(s->pb, w->loop); } } else { int ret; @@ -186,10 +186,11 @@ static int webp_write_trailer(AVFormatContext *s) return ret; filesize = avio_tell(s->pb); - avio_seek(s->pb, 4, SEEK_SET); - avio_wl32(s->pb, filesize - 8); - // Note: without the following, avio only writes 8 bytes to the file. - avio_seek(s->pb, filesize, SEEK_SET); + if (avio_seek(s->pb, 4, SEEK_SET) == 4) { + avio_wl32(s->pb, filesize - 8); + // Note: without the following, avio only writes 8 bytes to the file. + avio_seek(s->pb, filesize, SEEK_SET); + } } return 0;