RFR: 8353197: Document preconditions for JavaLangAccess methods [v2]
Volkan Yazici
vyazici at openjdk.org
Wed May 7 07:33:14 UTC 2025
On Thu, 1 May 2025 13:00:37 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix typo in pre-existing JavaDoc
>
> src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java line 315:
>
>> 313: * <b>WARNING: The caller of this method shall relinquish and transfer the
>> 314: * ownership of the byte array to the callee</b>, since the later will not
>> 315: * make a copy.
>
> I think we should add a note on why no copy is made - there may be multiple reads to the input array for decoding, so the input array must not be accessible by untrusted code, which can racily modify it. A side effect is that this array is simply reused if it's eligible to be the string content array, which is unfortunately abused in a few places in the JDK.
@liach, thank you so much for the review and the feedback. We internally discussed this and decided leave the change as is. Resolving this conversation. Please let me know if you think otherwise.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24982#discussion_r2076985931
More information about the security-dev
mailing list