From patchwork Fri Dec 3 04:57:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31900 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp202840iog; Thu, 2 Dec 2021 20:57:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjcFuZ5taLXxiOP27pZekaRD+9Y48TQhshg0dES0hsx1blLumEeyPjxZo9NnO+lw4qUqx4 X-Received: by 2002:a05:6402:5156:: with SMTP id n22mr24021564edd.222.1638507452640; Thu, 02 Dec 2021 20:57:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638507452; cv=none; d=google.com; s=arc-20160816; b=QiOVOIg7T4NGQPjYOnxlfy7SbR70MNlKImTf8lHKf5smHgrEBg5l4mpx33AcT+uBkF U/UyW9ovrUwITh3i0OX4zkJOwRGNYt0CaieV0753H8IMsPNFLCQOGOOwCc3SDg/GXcVe emBqLQxbfwPEdDgN1j/GKWF13Jw+K8p3PGWe3QJWmCqaLVsqxiya2Zan7b2UfOMCxINX G3ND+aAP6v9YeeR2jv7bjZPfiFPIfxRs8vxkE/qkhVd/qDIUnow/YGrA4xa9E+lSA1v4 dCBr7uDClurFw6Nd+vncytoijWX+EjTYa3bUu41vIGyrZX2HPKuJ3Po806j4E6xFXAES IVoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=dPPx5RBOW7h0LWRldEdPi8mbR/yNZaP4u++1sl8dxqc=; b=YrXqtmfjTyU/At+u04C4xa8o7VbVbm3shx8JpmMqo17FovrfQdj3QkOHvzHhJQ+pL9 RjsniyHRPe3F36PaNSCD0dHCYRQGMjN2dSpnzFsHl1tcGM7QzAMnKylTnfjzeW2c6X8G Ny1C1NT9HeztkTGZ5Mn0jCVeggUVfc8Ck8GwVHugIqYuDOnJglT6Lf2ibWcjToWiLTPH Z1R0sdnpcuPPYg3DmAMWYME5bI62M8M7tMx9dw3s6U4AkzERuJcV9Pkgq74I4KOE4By3 EjkttDqYRdklWDaWh7H/urL9B4s0rLEMMyCPQLzaYpdo9xJqnbmOA+UWS43zZpUSvhvq cFTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=kPqwnMTi; 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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e6si2187980ejt.581.2021.12.02.20.57.31; Thu, 02 Dec 2021 20:57:32 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=kPqwnMTi; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BB4BD68ADF6; Fri, 3 Dec 2021 06:57:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A6B286802C3 for ; Fri, 3 Dec 2021 06:57:19 +0200 (EET) Received: by mail-pl1-f178.google.com with SMTP id m24so1259562pls.10 for ; Thu, 02 Dec 2021 20:57:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=36R0IsKRwkDz1e7fQzDl9+boL76VQA5VAvJZ4CtJogk=; b=kPqwnMTiD6yOvdGkna+j4EJrQgphrS90zlbzxeCv/y0SFZrtbUXkWz7TFymSbRNubG 1BT1Bb0vtoG6JQPZG9+BeEDcUvwgPeRFtrZODmiCSFA0LM2ZArT9dk8m8SZRvGj/mNo7 jZfOyN7Q6VndmNvYDjH1nyCuewdJ8UcjevGLeNB/DgtLs1VcbDawm2V/LUuJkNd0fV+k gFxX8bAJ8gnPLETN+wkFYzcubQdc/IJchymsb1cGYbjC6UAk6te4C5VTsEmFXm9tVr9j rp3jfzsgy8GEckL7AvV5Wr/z9d2v1yX6YEcboDyp5/0i7sSCoXBffrF+LiU5A3S5iCgE pQPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=36R0IsKRwkDz1e7fQzDl9+boL76VQA5VAvJZ4CtJogk=; b=MgBKnI6DjHM3sXZDm/ohevji7whh1+BS3sGVqFARpaXBvgwkmA0Z/+viwTkLAxFQnf cCKLVo59Qtl09ssfr9KJD1PXFbvtafRhYivRVchkrjO0FeIfj07NV0pNvoq7RO/ja419 IwUFYcIQm6sO7fqRPUPDbdZ4/c0krIyt9vpXDr8UkfDw8mlC4RwZjUjELIRfpKyC6i9E VqRYTb3Z3aLFzy8/4vEAjZJg+a20dXvxrVMf+pgiDkyAT6LPtJIJVWvOmbEv9NdXjkTq m7MjzRXyQQwzBarDIvw52FrBJrc7lt/rHknHAUexDHnqrujrMiml/K/AOIfGtVLrt6oQ PAAA== X-Gm-Message-State: AOAM531dc6MBYp/X0dDahA6XUK87IJUzqgald/JDyY9Le+QN53h2OWrB 495oWp4ASiZg75kaIcDIyCxVQF+nANg= X-Received: by 2002:a17:903:22cc:b0:142:d31:bd9 with SMTP id y12-20020a17090322cc00b001420d310bd9mr20240062plg.64.1638507437528; Thu, 02 Dec 2021 20:57:17 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id qe12sm4033532pjb.29.2021.12.02.20.57.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Dec 2021 20:57:17 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 3 Dec 2021 12:57:12 +0800 Message-Id: <1638507433-5005-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/aviobuf: check if read_packet() exist before read_packet_wrapper() 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1FYfFe5fPpzm From: Limin Wang without it, read_packet_wrapper() will return AVERROR(EINVAL) and avio_read will be failed. Signed-off-by: Limin Wang --- It'll fix the issue reported by Michael in below patch: https://patchwork.ffmpeg.org/project/ffmpeg/patch/1638441459-21819-1-git-send-email-lance.lmwang@gmail.com/ libavformat/aviobuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 5da4dea..14688a2 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -646,7 +646,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) while (size > 0) { len = FFMIN(s->buf_end - s->buf_ptr, size); if (len == 0 || s->write_flag) { - if((s->direct || size > s->buffer_size) && !s->update_checksum) { + if((s->direct || size > s->buffer_size) && !s->update_checksum && s->read_packet) { // bypass the buffer and read data directly into buf len = read_packet_wrapper(s, buf, size); if (len == AVERROR_EOF) {