[libcxx] r222052 - Initialize pointer in string conversion helpers to prevent MSAN diagnostic.

Evgeniy Stepanov eugenis at google.com
Tue Nov 18 01:44:09 PST 2014


We are missing interceptors for: wcstol, wcstoul, wcstoll, wcstoull.
On Mon Nov 17 2014 at 11:02:13 PM Kostya Serebryany <kcc at google.com> wrote:

> if msan does not see what's goign on inside libc we need to teach it -- it
> already has a bunch of libc interceptors, but clearly not all.
> Do you know what libc function is called here?
> Or how to reproduce the reports you've been seeing?
>
> On Fri, Nov 14, 2014 at 2:23 PM, Eric Fiselier <eric at efcs.ca> wrote:
>
>> Author: ericwf
>> Date: Fri Nov 14 16:23:57 2014
>> New Revision: 222052
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=222052&view=rev
>> Log:
>> Initialize pointer in string conversion helpers to prevent MSAN
>> diagnostic.
>>
>> Since the initialization of the pointer happens across the libc library
>> boundry
>> MSAN will not know the pointer was initialized. This fixes MSAN failures
>> in
>> test/strings/string.conversions.
>>
>> Modified:
>>     libcxx/trunk/src/string.cpp
>>
>> Modified: libcxx/trunk/src/string.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/string.cpp?rev=222052&r1=222051&r2=222052&view=diff
>>
>> ==============================================================================
>> --- libcxx/trunk/src/string.cpp (original)
>> +++ libcxx/trunk/src/string.cpp Fri Nov 14 16:23:57 2014
>> @@ -63,7 +63,7 @@ inline
>>  V
>>  as_integer_helper(const string& func, const S& str, size_t* idx, int
>> base, F f)
>>  {
>> -    typename S::value_type* ptr;
>> +    typename S::value_type* ptr = nullptr;
>>      const typename S::value_type* const p = str.c_str();
>>      typename remove_reference<decltype(errno)>::type errno_save = errno;
>>      errno = 0;
>> @@ -180,7 +180,7 @@ inline
>>  V
>>  as_float_helper(const string& func, const S& str, size_t* idx, F f )
>>  {
>> -    typename S::value_type* ptr;
>> +    typename S::value_type* ptr = nullptr;
>>      const typename S::value_type* const p = str.c_str();
>>      typename remove_reference<decltype(errno)>::type errno_save = errno;
>>      errno = 0;
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141118/3ea6cee5/attachment.html>


More information about the cfe-commits mailing list