RFR: JDK-8262472: Buffer overflow in UNICODE::as_utf8 for zero length output buffer
David Holmes
dholmes at openjdk.java.net
Mon Mar 1 03:03:39 UTC 2021
On Fri, 26 Feb 2021 17:47:12 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> This one is trivial and probably inconsequential, but lets fix it anyway.
>
> There is a buffer overflow in both variants of UNICODE::as_utf8, where in case of truncation due to a zero length output buffer the terminating zero still gets written.
>
> Added fix + gtest. Ran gtest.
Hi Thomas,
I'd rather treat passing a zero-length buffer as a programming error and assert the length is non-zero, rather than penalizing every correct call with an unnecessary precondition check.
Cheers,
David
-------------
PR: https://git.openjdk.java.net/jdk/pull/2753
More information about the hotspot-dev
mailing list