Integrated: 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:46 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);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This pull request has now been integrated.
Changeset: b85440d0
Author: Matthias Baesken <mbaesken at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/b85440d085e8f17908d2e8bd0fee87fce84a74a0
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
8361888: [GCC static analyzer] ProcessImpl_md.c Java_java_lang_ProcessImpl_forkAndExec error: use of uninitialized value '*(ChildStuff *)p.mode
Reviewed-by: rriggs, syan
-------------
PR: https://git.openjdk.org/jdk/pull/26316
More information about the core-libs-dev
mailing list