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

Usage of array placement new may lead to memory corruption

    Details

    • Subcomponent:
    • Resolved In Build:
      b04

      Backports

        Description

        Hotspot code contains a usage of an array placement new in ConcurrentHashTable: "new (memory) Bucket[_size]" where "memory" is allocated by malloc with size "_size * sizeof(Bucket)".

        This seems to be fine with nicely behaving compilers (hopefully all we use?).
        However, the C++ standard (Section 5.3.4/12) allows the array placement new to use more space than "_size * sizeof(Bucket)". In this case, we may write beyond the allocated memory.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mdoerr Martin Doerr
                  Reporter:
                  mdoerr Martin Doerr
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: