RFR: 8314236: Overflow in Collections.rotate [v2]
Nikita Sakharin
duke at openjdk.org
Fri Aug 18 21:31:32 UTC 2023
On Wed, 16 Aug 2023 21:38:09 GMT, Stuart Marks <smarks at openjdk.org> wrote:
>> Thanks! Done
>
> @nikita-sakharin
>
> Thanks for finding this bug and offering to fix it! (And @shipilev thanks for your assistance on this.)
>
> Putting the test into a separate JVM will work, but I don't think it's necessary to actually allocate the space. The test is only testing the indexes sent to `get` and `set` on the list, and it doesn't actually verify the contents of the list. (Presumably that's done by other tests.) Therefore it should be possible to create a "virtual" list of a given size that checks that the indexes are all in bounds but that doesn't actually store any elements. It should be fairly straightforward to do this by subclassing AbstractList and overriding a few methods.
>
> The advantage of not actually allocating 4G of memory is that it makes it easier to run a bunch of cases that test the boundary conditions. In fact I'd like to see that in the test, as opposed to testing this one case.
@stuart-marks
Thanks for your review! I rewrote the test according with your advise. All checks passed successfully.
Could you review the changes, please?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15270#discussion_r1297105328
More information about the core-libs-dev
mailing list