RFR: 8148005: One byte may be corrupted by get_datetime_string()
David Holmes
david.holmes at oracle.com
Thu Feb 4 04:00:43 UTC 2016
Looks good! Thanks for finding and fixing this.
David
On 4/02/2016 9:53 AM, Artem Smotrakov wrote:
> Hello,
>
> Please review this small one-line patch which fixes a potential one-byte
> corruption outside a buffer in get_datetime_string() function.
>
> diff -r 9fc51379c2c0 src/share/vm/utilities/ostream.cpp
> --- a/src/share/vm/utilities/ostream.cpp Wed Feb 03 18:48:29 2016 +0000
> +++ b/src/share/vm/utilities/ostream.cpp Wed Feb 03 15:52:28 2016 -0800
> @@ -380,7 +380,7 @@
> char* get_datetime_string(char *buf, size_t len) {
> os::local_time_string(buf, len);
> int i = (int)strlen(buf);
> - while (i-- >= 0) {
> + while (--i >= 0) {
> if (buf[i] == ' ') buf[i] = '_';
> else if (buf[i] == ':') buf[i] = '-';
> }
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8148005
> Webrev: http://cr.openjdk.java.net/~asmotrak/8148005/webrev.00/
>
> Artem
More information about the hotspot-runtime-dev
mailing list