From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id 5BF194CADF
	for <ffmpegdev@gitmailbox.com>; Fri, 11 Apr 2025 09:00:51 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0ED6668C17A;
	Fri, 11 Apr 2025 12:00:47 +0300 (EEST)
Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com
 [162.62.57.210])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C34FF687A92
 for <ffmpeg-devel@ffmpeg.org>; Fri, 11 Apr 2025 12:00:39 +0300 (EEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com;
 s=s201512; t=1744362035;
 bh=5ShjT1VcPGcKBBIN325neLLuTtNLoJX7Wam+gaNxXpU=;
 h=From:Subject:Date:References:To:In-Reply-To;
 b=pit9PQ+SGy7TBFoz8bh7UPdOYXUO4oVzymHd7ga25ZGUowpHTI/yw5p2rbhE2vB6G
 pi0rR7QawMEzTID9rhXgTV0XYtv0NqD1nN/diJhh+EmAnrSBYQzsP6Zava0qycw1xG
 gXxPL2VsVF6vjoCmdIBKil+5TEfEMDg694hOVht4=
Received: from smtpclient.apple ([119.147.10.242])
 by newxmesmtplogicsvrsza36-0.qq.com (NewEsmtp) with SMTP
 id 21B6C13; Fri, 11 Apr 2025 17:00:33 +0800
X-QQ-mid: xmsmtpt1744362033tkc7s4run
Message-ID: <tencent_2E0DD0B5E6CFA7CCAAA4532B9C428B87A606@qq.com>
X-QQ-XMAILINFO: NvH2zBBgt3uTTIYJ2WzfRJRpIPDvQhAgoYkziBIoEtW/PjiCpqaUsT4iG9zYRu
 U3kmueA19rJqFAr35i0Fu8iZC/YqROZzFKiqu628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, 11 Apr 2025 17:00:23 +0800
References: <tencent_079C0CE00E5AB635FB818234013E7F56A909@qq.com>
 <Z_jUgQrjVSXkDfvN@phare.normalesup.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
In-Reply-To: <Z_jUgQrjVSXkDfvN@phare.normalesup.org>
X-OQ-MSGID: <F84458AC-694A-4962-8F4E-370F170C2C75@foxmail.com>
X-Mailer: Apple Mail (2.3818.100.11.1.3)
Subject: Re: [FFmpeg-devel] [PATCH 00/22] Deprecate av_uninit
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/tencent_2E0DD0B5E6CFA7CCAAA4532B9C428B87A606@qq.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>



> On Apr 11, 2025, at 16:36, Nicolas George <george@nsup.org> wrote:
> 
> Zhao Zhili (HE12025-04-11):
>> From: Zhao Zhili <zhilizhao@tencent.com>
>> 
>> The macro is meant to suppress false uninitialized warnings. However,
>> sometimes these 'false uninitialized warnings' are really undefined
>> behavior, and leading to real issue like crash, e.g., ab792634197e.
>> 
>> For false uninitialized warnings, it can be silenced by initialization,
>> and compiler can easily optimize away unnecessary initializations.
>> 
>> av_uninit shouldn't be used in any case.
> 
> NAK, you are hiding the UBs, not fixing the bugs.
> 
> If the author of the code put av_uninit, that means they believe the
> value will always have been initialized by the part of the code
> responsible for it. If that is not true, then it is a bug that can lead
> to an exploitable security issue or a silent data corruption.
> 
> With your changes, nothing proves that the = 0 you put there is the
> right value, the bug is still there: the code expects the value to be
> correctly set, but instead there is an arbitrary 0.
> 
> At least, with av_uninit, valgrind and fuzzing can find the bugs.

With UB, the compiler can remove branch check and assign some random
value to it, which cannot be detected by valgrind.

For ab792634197e, the UB is there for decades and never detected by
valgrind, and the warning is silenced by av_uninit.

> 
> Regards,
> 
> -- 
>  Nicolas George
> _______________________________________________
> 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".

_______________________________________________
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".