RFR: 8313249: Fix -Wconversion warnings in verifier code [v2]
David Holmes
dholmes at openjdk.org
Sat Jul 29 12:23:51 UTC 2023
On Fri, 28 Jul 2023 21:27:39 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> src/hotspot/share/classfile/stackMapTableFormat.hpp line 481:
>>
>>> 479:
>>> 480: static u1 chops_to_frame_type(int chop) {
>>> 481: return (u1)(251 - chop);
>>
>> This looks dangerous. If the range is alway within `u1`, it should use `checked_cast<u1>`, and you should also assert `chop <= 251`.
>
> I agree, this one I should have used checked_cast and test the range of chop.
I also wondered about the range check but then I looked at the caller. No need to check it it in both places.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15056#discussion_r1278291467
More information about the hotspot-runtime-dev
mailing list