From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 2D94C490D8 for ; Thu, 2 May 2024 18:31:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2A27068D82A; Thu, 2 May 2024 21:31:46 +0300 (EEST) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4BAD868D80B for ; Thu, 2 May 2024 21:31:39 +0300 (EEST) Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6f043f9e6d7so8388255b3a.3 for ; Thu, 02 May 2024 11:31:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714674697; x=1715279497; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=UFslriNd7F7WnopYIg9tfaJOL0CZtbYkbuRy2cCKRKU=; b=aeA4OC8CKoyzF40FRROo9H+8ir7RTZ2HQIXDpJLVTY7AsCHyumCDA4oUZVbabBA37P lBwp1S5neolK32UrrQFprFmisi/HC3Wvcu3LTGuW2vr60g4lsd9Gnl5d1xJMPw2Guknr ElRBBPUB3jTSinRjQU+TMn5PY/ifCJCmA8ibcfie2x2Xljn3Sd+9PrZY+LZLfd9zw9PK sPRbnWIpay9gx0n64T+SpMycamOSQpLv+LM/f2Vrbfp2KBEiKW3q2Tf5A+odJkhbOosZ pRbWBbUPrLcfmpSiRpS5nF350XWFocfmCD4FkKtf2D2oYquYgkZM0t0Jn9Qc7pi4wYaC FaBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714674697; x=1715279497; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UFslriNd7F7WnopYIg9tfaJOL0CZtbYkbuRy2cCKRKU=; b=LVcq80eJYZwgI3zYKJ++S1V0Zs7vZmdixN5DZFSfT3Jf5J64XPpJuOBtjeyWqUQ1Mo gxvGE+ZpS9w0uCMpLcNMC473ItX8UhSGBBQDNo5vEjHVm6F9ZGt/lsqtXLls82OieeWu RqANPgr6JCi8M1NPJsoemtQt9+WN6RmEJiVUnFRvc4eepicBMnS2GJNDx3vKiEXx8Yle ZCeHCoMwm4YdddwCQaUvYPFuUN9fS92iHInm6ThKho/QHGho00Rk8XcII8XBbNB7D1om +cx7kxFAzJ6NHgCmtC+/BTK+j1/hBXd0fy/zXX+biXGy9zW4SsDHIg0FfAmDNR1YjEId iR/A== X-Gm-Message-State: AOJu0Yz2j/WKIKkz1FXIe7mG2sdkL9Frn/M0bzBzc3OgMxpt/ugUwQNB nq/3ilh9EPcbg2QrBOAkO5bhbACycYYMJ8C6Jhp+DuoHj1cp1dXqCqchDg== X-Google-Smtp-Source: AGHT+IGDX7yd/Zi6qU3/PBQ7xjDu/hrEwTmHVVpC71M34cIjcxxkWhrPzqXzGvKV1olRjYZmSn0Bdg== X-Received: by 2002:a05:6a00:a92:b0:6ec:fa34:34b6 with SMTP id b18-20020a056a000a9200b006ecfa3434b6mr495652pfl.13.1714674696757; Thu, 02 May 2024 11:31:36 -0700 (PDT) Received: from [192.168.0.10] ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d6-20020a056a0010c600b006ed048a7323sm1564799pfu.86.2024.05.02.11.31.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 May 2024 11:31:36 -0700 (PDT) Message-ID: <3191e450-5b13-4f77-b876-02d8e5fb7a42@gmail.com> Date: Thu, 2 May 2024 15:31:35 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: Content-Language: en-US From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/av1dec: Always set ret before goto end 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 5/2/2024 6:48 AM, Andreas Rheinhardt wrote: > Before 0f8763fbea4e8816cd54c2a481d4c048fec58394, av1_frame_ref() > and update_reference_list() could fail and therefore needed to > be checked, which incidentally set ret. This is no longer happening, > leading to a potential use of an uninitialized value which is > also the subject of Coverity ticket #1596605. > > Fix this by always setting ret before goto end; do not return > some random ancient value. > > Signed-off-by: Andreas Rheinhardt > --- > Here is a different approach that uses the translation from 0 to EAGAIN. > > libavcodec/av1dec.c | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c > index 79a30a114d..75cc3fba48 100644 > --- a/libavcodec/av1dec.c > +++ b/libavcodec/av1dec.c > @@ -1333,12 +1333,15 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) > > if (s->cur_frame.f) { > ret = set_output_frame(avctx, frame); > - if (ret < 0) > + if (ret < 0) { > av_log(avctx, AV_LOG_ERROR, "Set output frame error.\n"); > + goto end; > + } > } > > s->raw_frame_header = NULL; > i++; > + ret = 0; > > goto end; > } > @@ -1439,17 +1442,20 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) > > update_reference_list(avctx); > > - if (s->raw_frame_header->show_frame && s->cur_frame.f) { > - ret = set_output_frame(avctx, frame); > - if (ret < 0) { > - av_log(avctx, AV_LOG_ERROR, "Set output frame error\n"); > - goto end; > - } > - } > - raw_tile_group = NULL; > + raw_tile_group = NULL; > s->raw_frame_header = NULL; > + > if (show_frame) { > + // cur_frame.f needn't exist due to skip_frame. > + if (s->cur_frame.f) { > + ret = set_output_frame(avctx, frame); > + if (ret < 0) { > + av_log(avctx, AV_LOG_ERROR, "Set output frame error\n"); > + goto end; > + } > + } > i++; > + ret = 0; > goto end; > } > } Should be ok. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".