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

libjavajpeg: Fix compile warning in jchuff.c

    XMLWordPrintable

Details

    • 2d
    • b17

    Backports

      Description

        gcc warns on s390 and ppcle about negative array overflow at jchuff.c:806.

        /priv/d031900/openjdk/jdk-hs/source/src/java.desktop/share/native/libjavajpeg/jchuff.c:808:18: error: array subscript is below array bounds [-Werror=array-bounds]

        Adam Farley of IBM provided a fix:

        diff --git a/src/java.desktop/share/native/libjavajpeg/jchuff.c b/src/java.desktop/share/native/libjavajpeg/jchuff.c
        --- a/src/java.desktop/share/native/libjavajpeg/jchuff.c
        +++ b/src/java.desktop/share/native/libjavajpeg/jchuff.c
        @@ -805,7 +805,7 @@
           for (i = MAX_CLEN; i > 16; i--) {
             while (bits[i] > 0) {
               j = i - 2; /* find length of new prefix to be used */
        - while (bits[j] == 0)
        + while ((bits[j] == 0) && (j > 0))
                 j--;

               bits[i] -= 2; /* remove two symbols */

        Attachments

          Issue Links

            Activity

              People

                prr Philip Race
                stuefe Thomas Stuefe
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: