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

MemorySegment arithmetics performed with int accuracy where long is required

XMLWordPrintable

      The methods MemorySegment::copy are computing the destOffset parameter with int arithmetics when calling ScopedMemoryAccess.getScopedMemoryAccess().copy*Memory. But, for large values of elementCount and arrays of types other than byte[] (e.g. long[]), this may silently overflow causing an undefined value (including negative values) to be used for subsequent Unsafe calls which, in turn, may cause a JVM crash or even worse, may quietly mutate arbitrary process memory.

            pminborg Per-Ake Minborg
            pminborg Per-Ake Minborg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 4 hours
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified