From patchwork Mon Mar 27 08:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 40859 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7a30:b0:df:834d:2c1a with SMTP id t48csp1127961pzh; Mon, 27 Mar 2023 01:00:37 -0700 (PDT) X-Google-Smtp-Source: AKy350alci/d0aBOyzGgbMhl2w/ATY6yUIN0hrRL/cj9OkDArzXnQSfoj6EfySK7ggChs2luLS1O X-Received: by 2002:aa7:da82:0:b0:502:100c:53a with SMTP id q2-20020aa7da82000000b00502100c053amr11424709eds.41.1679904037578; Mon, 27 Mar 2023 01:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679904037; cv=none; d=google.com; s=arc-20160816; b=gdJ8Kx4OnPLgqe6daua1wnTHzSpUxDioCPMaoK8WqTsRj0YwoYk0yZ5KbGDLvQB2Om u+Do9ahdf45F4ekX0VBtIKaMp8pb4uAhSHr/JJwzK2R/mecdem4GRS2m+sZJq4/KWGa4 fV6CEVVbeRVSOfnepKyNxlARroxBualNiQCTMREpi7dnSR2K9elKUFDZc0W6abTvtaW4 GRNfkwbKfLCfnZMO1HmUKItCNPUmOC58P7r9kIt8ulFXqXq0SOYWG146QSSry4g5eS07 8uxJyhj5bzVNyQiQvTuWeKgjyj6+oSfdigNM5ywrbFrIK6jz0VqhdLUZukbHEO+lz1LV 9Edg== 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 :delivered-to; bh=Pg/P57OayKjXaysJe5kcDNRHMqX2kwY0SlH5knR8yP4=; b=EdeGbaezx7p6XgpP7iqjQ17acugqcgZXFI3n749M9rMvxrhWFyvt7s3UmJNXj66MJc QRhZ4CDq8+7sKoQ13o4KDq0HAHlg06bpMACKYyO0ltVEgHUTyt+kS8iEJjoTtBUv9lNW HIRlNIV0GFMkddY9xeZJBKJjlUH95P7pRZNqkzA+2Af+TbWthZtMeqOBW+xoRk1oD60S DZLXeyGH/+3S8sn2D1wm3+6J2wDSzJTDdIhnqy5uL5YSRDAylcdl8ZItyNo3m/tuxgf9 1IIP+WpS2dCDD59NY+Uu4ORyyMv1MKl55rUvkZLp0t7wA9Icup74E7ggM2lYTA7wOLOF H7Vw== ARC-Authentication-Results: i=1; mx.google.com; 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 z1-20020aa7c641000000b004fd2aaa62d0si27120282edr.242.2023.03.27.01.00.36; Mon, 27 Mar 2023 01:00:37 -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; 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 A0FA268CA95; Mon, 27 Mar 2023 11:00:33 +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 7032368C541 for ; Mon, 27 Mar 2023 11:00:27 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 295862404EA for ; Mon, 27 Mar 2023 10:00:27 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id wulyVr3I7_CX for ; Mon, 27 Mar 2023 10:00:26 +0200 (CEST) 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 mail0.khirnov.net (Postfix) with ESMTPS id 6455B240178 for ; Mon, 27 Mar 2023 10:00:26 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 0F5333A00B6 for ; Mon, 27 Mar 2023 10:00:26 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Mar 2023 10:00:23 +0200 Message-Id: <20230327080023.28400-1-anton@khirnov.net> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavf: return AVERROR_EOF rather than EIO on EOF 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: 0Yu5hBFz416z --- libavformat/anm.c | 2 +- libavformat/dauddec.c | 2 +- libavformat/filmstripdec.c | 2 +- libavformat/idroqdec.c | 2 +- libavformat/sol.c | 3 ++- libavformat/vc1test.c | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/anm.c b/libavformat/anm.c index 7feba4ed1e7..f2ac6958a9a 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -172,7 +172,7 @@ static int read_packet(AVFormatContext *s, int tmp, record_size; if (avio_feof(s->pb)) - return AVERROR(EIO); + return AVERROR_EOF; if (anm->page < 0) return anm->page; diff --git a/libavformat/dauddec.c b/libavformat/dauddec.c index dbbd39a3b40..0cbf7e4e368 100644 --- a/libavformat/dauddec.c +++ b/libavformat/dauddec.c @@ -41,7 +41,7 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; int ret, size; if (avio_feof(pb)) - return AVERROR(EIO); + return AVERROR_EOF; size = avio_rb16(pb); avio_rb16(pb); // unknown ret = av_get_packet(pb, pkt, size); diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 2b6ba63fcf0..000f807181d 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -86,7 +86,7 @@ static int read_packet(AVFormatContext *s, AVStream *st = s->streams[0]; if (avio_feof(s->pb)) - return AVERROR(EIO); + return AVERROR_EOF; pkt->dts = avio_tell(s->pb) / (st->codecpar->width * (int64_t)(st->codecpar->height + film->leading) * 4); pkt->size = av_get_packet(s->pb, pkt, st->codecpar->width * st->codecpar->height * 4); avio_skip(s->pb, st->codecpar->width * (int64_t) film->leading * 4); diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index c9fc972780a..01ea2bb77ba 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -107,7 +107,7 @@ static int roq_read_packet(AVFormatContext *s, while (!packet_read) { if (avio_feof(s->pb)) - return AVERROR(EIO); + return AVERROR_EOF; /* get the next chunk preamble */ if ((ret = avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) != diff --git a/libavformat/sol.c b/libavformat/sol.c index b92cfb36fee..a276642728c 100644 --- a/libavformat/sol.c +++ b/libavformat/sol.c @@ -127,7 +127,8 @@ static int sol_read_packet(AVFormatContext *s, int ret; if (avio_feof(s->pb)) - return AVERROR(EIO); + return AVERROR_EOF; + ret= av_get_packet(s->pb, pkt, MAX_SIZE); if (ret < 0) return ret; diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index 67edc699c5f..f63ffee69bb 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -101,7 +101,7 @@ static int vc1t_read_packet(AVFormatContext *s, uint32_t pts; if(avio_feof(pb)) - return AVERROR(EIO); + return AVERROR_EOF; frame_size = avio_rl24(pb); if(avio_r8(pb) & 0x80)