Details

    • Subcomponent:
    • Resolved In Build:
      b23

      Backports

        Description

        In one fatal error code path, snprintf() is given its output buffer as
        an input string.

        src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c line 645:

            (void)snprintf(buf, sizeof(buf), "JDWP %s", buf);

        This was found by compiling with GCC 8.1


        $ make all
        Building target 'all' in configuration 'linux-x86_64-server-release'
        Updating support/modules_libs/jdk.jdwp.agent/libjdwp.so due to 1 file(s)
        /home/stooke/dev/openjdk/jdk12/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c: In function ‘jniFatalError’:
        /home/stooke/dev/openjdk/jdk12/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:650:24: error: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
                 (void)snprintf(buf, sizeof(buf), "JDWP %s", buf);
                                ^~~ ~~~
        /home/stooke/dev/openjdk/jdk12/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c: In function ‘jniFatalError.constprop’:
        /home/stooke/dev/openjdk/jdk12/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:650:48: error: ‘%s’ directive output may be truncated writing up to 511 bytes into a region of size 507 [-Werror=format-truncation=]
                 (void)snprintf(buf, sizeof(buf), "JDWP %s", buf);
                                                        ^~ ~~~
        /home/stooke/dev/openjdk/jdk12/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:650:15: note: ‘snprintf’ output between 6 and 517 bytes into a destination of size 512
                 (void)snprintf(buf, sizeof(buf), "JDWP %s", buf);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
        gmake[3]: *** [Lib-jdk.jdwp.agent.gmk:54: /home/stooke/dev/openjdk/jdk12/build/linux-x86_64-server-release/support/native/jdk.jdwp.agent/libjdwp/debugInit.o] Error 1
        gmake[2]: *** [make/Main.gmk:215: jdk.jdwp.agent-libs] Error 2
        gmake[2]: *** Waiting for unfinished jobs....
        ^Cmake[1]: *** [/home/stooke/dev/openjdk/jdk12/make/Init.gmk:310: main] Interrupt
        make: *** [/home/stooke/dev/openjdk/jdk12/make/Init.gmk:186: all] Interrupt

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sgehwolf Severin Gehwolf
                  Reporter:
                  sgehwolf Severin Gehwolf
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: