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
Tue Jul 15 12:55:50 UTC 2025


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);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-------------

Commit messages:
 - JDK-8361888

Changes: https://git.openjdk.org/jdk/pull/26316/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26316&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8361888
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/26316.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26316/head:pull/26316

PR: https://git.openjdk.org/jdk/pull/26316


More information about the core-libs-dev mailing list