[FFmpeg-devel] [PATCH 00/22] Deprecate av_uninit
Zhao Zhili
quinkblack at foxmail.com
Fri Apr 11 12:19:45 EEST 2025
> On Apr 11, 2025, at 16:36, Nicolas George <george at nsup.org> wrote:
>
> Zhao Zhili (HE12025-04-11):
>> From: Zhao Zhili <zhilizhao at 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.
By the way, logic bug isn’t equal to UB, so I’m not hiding UB.
Who put av_uninit in the code means there is no logic bug. If there is,
the patchset fixed UB or replaced UB by deterministic logic error, which
can’t be worse.
>
> 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.
If there is no bug for code with av_uninit, the patchset does nothing really.
If there is, the patchset fixed or makes the issue deterministic.
We don’t initialized all variables when declaration. But if there is a
sometimes-uninitialized warning, there is some reason for compiler.
Uninitialized warning isn’t the same as deprecated or unused, it should
never be ignored in my opinion.
>
> 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.
>
> Regards,
>
> --
> Nicolas George
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list