RFR: [8036088] - Thread-unsafe strtok() is used to parse
Salter, Thomas A
Thomas.Salter at unisys.com
Mon Mar 3 12:26:01 PST 2014
strtok is thread-safe in MS C/C++. It uses thread-local store to hold its state. strtok_s can be called recursively to parse different strings, though it's named like the MS extensions that check for buffer overruns.
http://msdn.microsoft.com/en-us/library/2c8d19sb(v=vs.100).aspx
------------------------------
Message: 5
Date: Mon, 03 Mar 2014 21:01:15 +0400
From: Ivan Gerasimov <ivan.gerasimov at oracle.com>
Subject: Re: RFR: [8036088] - Thread-unsafe strtok() is used to parse
the list of overrides
To: Christos Zoulas <christos at zoulas.com>, OpenJDK Network Dev list
<net-dev at openjdk.java.net>
Message-ID: <5314B55B.9070406 at oracle.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Hi Christos!
On 03.03.2014 20:52, christos at zoulas.com wrote:
> On Mar 3, 8:32pm, ivan.gerasimov at oracle.com (Ivan Gerasimov) wrote:
> -- Subject: RFR: [8036088] - Thread-unsafe strtok() is used to parse the list
>
> | Hello!
> |
> | The strtok() function is used in
> | ./windows/native/sun/net/spi/DefaultProxySelector.c.
> | This function is not thread safe, so it may potentially cause a problem.
> |
> | The failure in this particular place would be very unlikely, because
> | this code should be executed only once during initialization.
> | Therefore, no regtest provided.
> |
> | The fix would be to use a thread-safe equivalent, which is strtok_s()
> | under Windows.
> |
> | Would you please help review this simple fix?
> |
> | BUGURL: https://bugs.openjdk.java.net/browse/JDK-8036088
> | WEBREV: http://cr.openjdk.java.net/~igerasim/8036088/0/webrev/
>
> Doesn't windows have strtok_r() IEEE Std 1003.1c-1995 (``POSIX.1'').
MSDN does not refer to strtok_r().
Grepping the JDK code shows that strtok_s() is used in the
windows-specific code.
Sincerely yours,
Ivan
> christos
>
>
End of net-dev Digest, Vol 81, Issue 3
**************************************
More information about the net-dev
mailing list