Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8266167 Clean up GCC 11 warnings
  3. JDK-8266171

-Warray-bounds happens in imageioJPEG.c

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: client-libs
    • Labels:
      None

      Description

      /home/ysuenaga/git-forked/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c: In function 'Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initJPEGImageWriter':
      /home/ysuenaga/git-forked/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c:673:23: warning: array subscript 'struct jpeg_decompress_struct[0]' is partly outside array bounds of 'unsigned char[520]' [-Warray-bounds]
        673 | free(dinfo->src);
            | ~~~~~^~~~~
      /home/ysuenaga/git-forked/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c:2538:9: note: referencing an object of size 520 allocated by 'malloc'
       2538 | malloc(sizeof(struct jpeg_compress_struct));
            | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /home/ysuenaga/git-forked/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c:674:24: warning: array subscript 'struct jpeg_decompress_struct[0]' is partly outside array bounds of 'unsigned char[520]' [-Warray-bounds]
        674 | dinfo->src = NULL;
            | ^
      /home/ysuenaga/git-forked/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c:2538:9: note: referencing an object of size 520 allocated by 'malloc'
       2538 | malloc(sizeof(struct jpeg_compress_struct));
            | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: