[cfe-dev] [patch] added a _LIBCPP_ASSERT to std::string::__init( __first, __last ) to ensure [__first,__last] is valid
cfe-dev at lists.llvm.org
Mon Sep 19 11:12:07 PDT 2016
Currently, std::string::string( it_first, it_last ) does not check that
the range is valid, which results in a very huge memory reservation.
This reservation might result in an immediate throw, but depending on
OSes and/or OSes'configuration (overcommit parameters on linux *might*
avoid the throw, for exemple) it could also only lead to a crash far
than the source of the problem.
This patch simply adds an assertion to be sure that the range is valid
(distance(last,first)>=0) when explicitly asked by the developer
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2076 bytes
Desc: not available
More information about the cfe-dev