This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Avoid strtok for thread safety


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]