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

stringop-overflow warning on strncpy call from compile_the_world_in

    Details

    • Subcomponent:
    • Resolved In Build:
      b01

      Backports

        Description

        fastdebug builds of 8u and 11u result in the following warning when compiling with gcc 8.3:

        /home/dbuck/backports/sanity/jdk11u-cpu/open/src/hotspot/share/classfile/classLoader.cpp: In static member function 'static void ClassLoader::compile_the_world_in(char*, Handle, Thread*)':
        /home/dbuck/backports/sanity/jdk11u-cpu/open/src/hotspot/share/classfile/classLoader.cpp:2039:12: warning: 'char* strncpy(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Wstringop-overflow=]
             strncpy(buffer, name, len - 6);
             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
        /home/dbuck/backports/sanity/jdk11u-cpu/open/src/hotspot/share/classfile/classLoader.cpp:173:26: note: length computed here
           size_t str_len = strlen(str);
                            ~~~~~~^~~~~

        This warning will cause builds to fail when warnings-as-errors is enabled (the default).

        This code was removed in JDK 12 (see JDK-8213812), so JDK 11 and JDK 8 are the only LTS versions that need to be fixed. There are a number of similar issues elsewhere in 11u, but they can hopefully be addressed by backporting preexisting fixes from later releases.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dbuck David Buck
                  Reporter:
                  dbuck David Buck
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: