RFR: 8361888: [GCC static analyzer] ProcessImpl_md.c Java_java_lang_ProcessImpl_forkAndExec error: use of uninitialized value '*(ChildStuff *)p.mode
Matthias Baesken
mbaesken at openjdk.org
Wed Jul 16 07:24:45 UTC 2025
On Tue, 15 Jul 2025 12:51:09 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:
> When using GCC static analyzer (-fanalyzer), the following issue is reported.
> Seems `c->mode` is initialized later in the method, but we use it already in the exception, this looks wrong.
>
>
> /jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c: In function 'Java_java_lang_ProcessImpl_forkAndExec':
> /jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c:735:9: error: use of uninitialized value '*(ChildStuff *)p.mode' [CWE-457] [-Werror=analyzer-use-of-uninitialized-value]
> 735 | throwInternalIOException(env, errno, "Bad file descriptor", c->mode);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks for the reviews !
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26316#issuecomment-3077280423
More information about the core-libs-dev
mailing list