[libcxx] r177452 - Marshall Clow found this memory problem in strstream using -fsanitize=address on the test suite.
Howard Hinnant
hhinnant at apple.com
Tue Mar 19 15:16:58 PDT 2013
Author: hhinnant
Date: Tue Mar 19 17:16:57 2013
New Revision: 177452
URL: http://llvm.org/viewvc/llvm-project?rev=177452&view=rev
Log:
Marshall Clow found this memory problem in strstream using -fsanitize=address on the test suite.
Modified:
libcxx/trunk/src/strstream.cpp
Modified: libcxx/trunk/src/strstream.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/strstream.cpp?rev=177452&r1=177451&r2=177452&view=diff
==============================================================================
--- libcxx/trunk/src/strstream.cpp (original)
+++ libcxx/trunk/src/strstream.cpp Tue Mar 19 17:16:57 2013
@@ -158,6 +158,8 @@ strstreambuf::overflow(int_type __c)
return int_type(EOF);
streamsize old_size = (epptr() ? epptr() : egptr()) - eback();
streamsize new_size = max<streamsize>(__alsize_, 2*old_size);
+ if (new_size == 0)
+ new_size = __default_alsize;
char* buf = nullptr;
if (__palloc_)
buf = static_cast<char*>(__palloc_(static_cast<size_t>(new_size)));
More information about the cfe-commits
mailing list