[2/2] Add AddressSanitizer annotations to std::string.

Jonathan Wakely jwakely@redhat.com
Tue May 29 15:55:00 GMT 2018


On 29/05/18 18:18 +0300, Kashkarov Mikhail wrote:
>Jonathan Wakely <jwakely@redhat.com> writes:
>>>--- a/libstdc++-v3/include/bits/fstream.tcc
>>>+++ b/libstdc++-v3/include/bits/fstream.tcc
>>>@@ -1081,6 +1081,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>>
>>>   // Inhibit implicit instantiations for required instantiations,
>>>   // which are defined via explicit instantiations elsewhere.
>>>+#if !_GLIBCXX_SANITIZE_STRING
>>> #if _GLIBCXX_EXTERN_TEMPLATE
>>>   extern template class basic_filebuf<char>;
>>>   extern template class basic_ifstream<char>;
>>>@@ -1094,6 +1095,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>>   extern template class basic_fstream<wchar_t>;
>>> #endif
>>> #endif
>>>+#endif // !_GLIBCXX_SANITIZE_STRING
>>
>> Why do we need to disable these explicit instantiation declarations?
>> Are they affected by the std::string layout changes? Is that just
>> because of the constructors taking std::string, or something else?
>
>Libstdc++ build is not sanitized, so macroses that requires
>AddressSanitizer support will not applied and these templates will be
>instantate without support for ASan annotations.

Right, I was wondering specifically about the <fstream>
instantiations. I could be wrong but I don't think anything in
<fstream> creates, destroys or modifies a std::basic_string.




More information about the Libstdc++ mailing list