[PATCH] Avoid strtok for thread safety
Paolo Carlini
pcarlini@unitus.it
Tue Nov 26 22:10:00 GMT 2002
Nathan Myers wrote:
>strpbrk() returns NULL if it doesn't find any of the characters
>searched for. What happens then?
>
Everything can happen, probably a segmentation fault. There are no checks on
the validity of the string, *exactly* as there weren't before.
If the string is constructed by locale::locale(const char*) this is not
really an issue,
but, as you said before, if it's passed by the user it can be, if we
want: someone told
me that this area is basically QoI, since the standard prescribes
nothing about
all of it.
So...
We should decide together which checks to add, how much expensive and
what to do
if they are not ok. Perhaps throw an exception? Which one?
Ciao, Paolo.
More information about the Libstdc++
mailing list