Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8361888

[GCC static analyzer] ProcessImpl_md.c Java_java_lang_ProcessImpl_forkAndExec error: use of uninitialized value '*(ChildStuff *)p.mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 26
    • 26
    • core-libs
    • None
    • b07
    • generic
    • generic

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

            mbaesken Matthias Baesken
            mbaesken Matthias Baesken
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: