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

GCC 12 reports use-after-free potential bugs

XMLWordPrintable

    • b23

        GCC 12 reports use-after-free potential bugs in below:

        ```
        In function 'find_positions',
            inlined from 'find_file' at /home/ysuenaga/github-forked/jdk/src/java.base/share/native/libjli/parse_manifest.c:364:9:
        /home/ysuenaga/github-forked/jdk/src/java.base/share/native/libjli/parse_manifest.c:292:34: warning: pointer 'endpos' used after 'free' [-Wuse-after-free]
          292 | pos = flen - (endpos - cp);
              | ~~~~~~~~^~~~~
        /home/ysuenaga/github-forked/jdk/src/java.base/share/native/libjli/parse_manifest.c:291:13: note: call to 'free' here
          291 | free(buffer);
              | ^~~~~~~~~~~~
        Updating jdk/modules/jdk.jpackage/jdk/jpackage/internal/resources/jpackageapplauncher due to 1 file(s)
        /home/ysuenaga/github-forked/jdk/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c: In function 'popenCommand':
        /home/ysuenaga/github-forked/jdk/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c:180:63: warning: pointer 'strBufBegin' may be used after 'realloc' [-Wuse-after-free]
          180 | strBufNextChar = strNewBufBegin + (strBufNextChar - strBufBegin);
              | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
        /home/ysuenaga/github-forked/jdk/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c:174:30: note: call to 'realloc' here
          174 | strNewBufBegin = realloc(strBufBegin, strBufCapacity);
              | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        ```

              ysuenaga Yasumasa Suenaga
              ysuenaga Yasumasa Suenaga
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: