RFR: 8306561: Possible out of bounds access in print_pointer_information [v6]

Thomas Obermeier duke at openjdk.org
Mon Nov 6 14:53:39 UTC 2023


On Thu, 2 Nov 2023 19:44:12 GMT, Dean Long <dlong at openjdk.org> wrote:

>> Thomas Obermeier has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Merge branch 'JDK-8306561' of https://github.com/TOatGithub/jdk into JDK-8306561
>>  - 8306561: test range instead of endpoints before casting
>
> src/hotspot/share/nmt/mallocTracker.cpp line 215:
> 
>> 213:     for (; here >= end; here -= smallest_possible_alignment) {
>> 214:       // JDK-8306561: cast to a MallocHeader needs to guarantee it can reside in readable memory
>> 215:       if (!os::is_readable_range(here, here + sizeof(MallocHeader) - 1)) {
> 
> Sorry I noticed this late, but the " - 1" looks wrong here, because is_readable_range() checks for < `to`, not <= `to`.

Hi Dean, thanks for finding this. I opened https://bugs.openjdk.org/browse/JDK-8319542 to address this and will fix it in a timely manner.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16381#discussion_r1383459624


More information about the hotspot-dev mailing list