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);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- relates to
-
JDK-8362516 Support of GCC static analyzer (-fanalyzer)
-
- New
-
- links to
-
Commit(master) openjdk/jdk/b85440d0
-
Review(master) openjdk/jdk/26316