From patchwork Tue Jul 23 13:16:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 50712 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a742:0:b0:482:c625:d099 with SMTP id f2csp2633579vqm; Tue, 23 Jul 2024 06:41:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWyB3ZA3NMcin+4l9O8uvi7hmMEcnGo3kVkxB9c7vr75Y+sBMsMsTi9d7BjprZTCITbiem+ao578Bu8uJ5A23BV1K2fNxQlOoW+6A== X-Google-Smtp-Source: AGHT+IHtoxAgD/q/P75cxe/D5QVN5/UaBoF43wTs0CoaeguJS9u2B2yvlE2ElxXpgC5fYTQQZb5m X-Received: by 2002:a17:907:3dab:b0:a77:f5fc:cb61 with SMTP id a640c23a62f3a-a7a9303d8a1mr235658066b.0.1721742110452; Tue, 23 Jul 2024 06:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721742110; cv=none; d=google.com; s=arc-20160816; b=ZHrFhW05Ug9Qn/n3AuK0eKArc48GYa6reaCy41e3ghPbh7eg3xwrIcOUgxuj+hqeAb iPda4UlBHUXOQ+HCQpr5wjyvW0d0a7Jw1b2lcgi2/rVZALjkidmP3rR98SCs3lUOSrBU Ab1UWe+MQJjNvWBLxBPngLtm/VJZHJCi/SCAkz56K3FcICNeAWmyrelmwjgSkP9BO55B KSHgYKinH5NCt+TnUhopDO7/pKDW5xphwvW0fnqgbE88uSZ/LE/GdcIj9ZYQLRZ2a82m aQwGeWsQY8cR6igabZ2Dtd+6YLHPv0dOyEZVILTUkfqIVER02lxpjWb06zvkhqlfwdoh XXsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=jyCRM8nhXUSMUh+gplBQQ8O9y0ql8U9X9gJ5FvkUMrw=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=ZkEMUoNNgCVyBCyQ5KWXtPWmfrf2Z0U3OJQV6wXVpgG50ib03oDmXkkHEhPK8QboHP oTdZsZuRNZjIp6oPMb9ELnAJn8WkVrgki4Okch4x+HBWzdbGrYDShhBteS3rbdP5vgWo 8mAFEfTuLV8dyLYWx50z5ikq5z9wNiRUeXL+826mp9bDfjMJrNWzkZR+N+jmSJdPPONv 46WV0BgWG7uC0FlGMYgYOHWRKUrpOoRJUA+6TfHzSSco/plIapnZjB3864f4+jA1+A5q ixVD+emUCwjN/AnG0hFHW+wLU1XDrh/2cQMeJUxs9Oe9KBE9ujffgaGqwH6EOM73Rdda TYHA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=Fepf1RBp; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a7a3c926afcsi548051566b.648.2024.07.23.06.41.49; Tue, 23 Jul 2024 06:41:50 -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=@khirnov.net header.s=mail header.b=Fepf1RBp; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1D49B68D534; Tue, 23 Jul 2024 16:16:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E0BAE68CC25 for ; Tue, 23 Jul 2024 16:16:16 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=Fepf1RBp; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id B00CF4DDB for ; Tue, 23 Jul 2024 15:16:14 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id s8zfrgPvTjJZ for ; Tue, 23 Jul 2024 15:16:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1721740573; bh=U1kx6eQ0jTAz7UwSxFv42LNHUoolUutGG/D561k5Rgs=; h=From:To:Subject:Date:From; b=Fepf1RBp6he5nQ8RHBNyb1DauC+lq6maILnl7b335rIDYDnQEaSKqnmZLaOumAmDc EIKNNAHcGOWpjXj5bWDQlCM6VmRMcee4dU4q9yhWI2qxFhxooRo2gbSHtK+hyhsP8X K/e36mMFBvu7FhLGA2FysSFumJUyyRogiRI9kdFCqt6xhqibFxbBZ9DU7qmK3y13sq jCnwsIjLS+IHT93tf7jzJDbVCGoJCaodAAq80lZEoPjZfFAwXcdOO2c9QFqJs6IBVQ Nd+TGKVegKKF7XNRouJHDVHbNDLWfkSKXyP1JXmBUWT/QQv2JH1lXX7Q6ilRsQAY8H bU64FTEWLGvGw== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (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 mail1.khirnov.net (Postfix) with ESMTPS id B26CA998 for ; Tue, 23 Jul 2024 15:16:13 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 7B3C23A02B4 for ; Tue, 23 Jul 2024 15:16:07 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Jul 2024 15:16:06 +0200 Message-ID: <20240723131606.13307-1-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] fftools/ffmpeg: prefer real errors over EOF in err_merge() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ZHPmE3NdmEwK Fixes an issue in 6.1 when reading a corrupted file with -xerror would exit with success. This specific issue is not present in master, but this should generally be a more robust behaviour. Reported-by: Andrej Peterka --- fftools/ffmpeg_utils.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg_utils.h b/fftools/ffmpeg_utils.h index bd225abc38..7939e44cdc 100644 --- a/fftools/ffmpeg_utils.h +++ b/fftools/ffmpeg_utils.h @@ -35,11 +35,12 @@ typedef struct Timestamp { /** * Merge two return codes - return one of the error codes if at least one of * them was negative, 0 otherwise. - * Currently just picks the first one, eventually we might want to do something - * more sophisticated, like sorting them by priority. */ static inline int err_merge(int err0, int err1) { + // prefer "real" errors over EOF + if ((err0 >= 0 || err0 == AVERROR_EOF) && err1 < 0) + return err1; return (err0 < 0) ? err0 : FFMIN(err1, 0); }