[libstdc++ patch] Fix basic_string::_S_construct null pointer check

Doug Gregor dgregor@apple.com
Mon Jul 14 18:48:00 GMT 2003


basic_string::_S_construct attempts to do a null-pointer check by 
comparing the "__beg" iterator to a default-constructed iterator of the 
same type. This both triggers an error in debug mode ("attempt to 
compare against a singular iterator") and could cause incorrect 
behavior in release mode in the following unlikely circumstance:

	1) [begin, end) is an empty iterator range, and
	2) end is equal to a default-constructed iterator, and
	3) the user passes in an allocator that is not equivalent to a 
default-constructed allocator

Tested on powerpc-apple-darwin; no regressions in debug or release 
mode. Okay to commit?

	Doug

-------------- next part --------------
A non-text attachment was scrubbed...
Name: string_construct_null.patch
Type: application/octet-stream
Size: 1365 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030714/4579faa6/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: string_construct_null.ChangeLog
Type: application/octet-stream
Size: 206 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030714/4579faa6/attachment-0001.obj>


More information about the Libstdc++ mailing list