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

Signed integer overflow in ImageStrings::hash_code (libjimage.so)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 11
    • 11
    • tools
    • None
    • b14
    • generic
    • linux

    Backports

      Description

        With an instrumented version of imageFile.o (via -fsanitize=undefined) a signed integer overflow is revealed which is undefined behaviour.

        $ bin/java -version
        /disk/openjdk/upstream-sources/openjdk-hs/src/java.base/share/native/libjimage/imageFile.cpp:64:22: runtime error: signed integer overflow: 16777619 * 16777619 cannot be represented in type 'int'
        /disk/openjdk/upstream-sources/openjdk-hs/src/java.base/share/native/libjimage/imageFile.cpp:64:22: runtime error: signed integer overflow: 16777620 * 16777619 cannot be represented in type 'int'
        openjdk version "11-internal" 2018-09-25
        OpenJDK Runtime Environment (fastdebug build 11-internal+0-adhoc.sgehwolf.openjdk-hs)
        OpenJDK 64-Bit Server VM (fastdebug build 11-internal+0-adhoc.sgehwolf.openjdk-hs, mixed mode)

        This caused a build failure of the images target with GCC 8 (-O2) where the interim image was broken like this:

        ./build/linux-x86_64-normal-server-fastdebug/support/interim-image/bin/java -version
        Error occurred during initialization of VM
        java/lang/NoClassDefFoundError: java/lang/Object

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: