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

Bad cast in GrowableArrayWithAllocator<>::grow

XMLWordPrintable

    • b06

      GrowableArrayWithAllocator<>::grow takes an int argument, which is the size to grow from. It uses `next_power_of_2` of that value to determine the size to grow to. Unfortunately, it casts the `int` value to `uint32_t`. As a result, the overflow checks in `next_power_of_2` will be based on the wrong type, leading to a negative new size instead of assertion failure if the size is already large. There are later asserts that will fail for that, but it would be better to remove the offending cast.

            azafari Afshin Zafari
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: