<div dir="ltr">I've got an application I built with -fsanitize=address, and I'm linking against a third party library foo.a which was not built with -fsanitize=address.  Both of these libraries use -stdlib=libc++.<div><br></div><div>In my code I do something like this:</div><div><br></div><div>// This code is instrumented</div><div>void MyProgram() {<br></div><div>    std::vector<std::string> v;</div><div>    std::string s;</div><div>    Library::DoSomethingUseful(v, s);</div><div>}</div><div><br></div><div><br></div><div>And this is implemented as:</div><div><br></div><div>// This code is not instrumented:</div><div>namespace Library {</div><div>    void DoSomethingUseful(std::vector<std::string> &v, const std::string &s) {</div><div>        for (int i=0; i < 10; ++i)</div><div>            v.push_back(s);</div><div>    }</div><div>}</div><div><br></div><div>This results in an ASAN container-overflow in libc++, which makes sense because the library's version isn't instrumented.  Is there any way to suppress this?</div><div><br></div><div>The actual call-stack looks like this:</div><div><br></div><div>==120108==ERROR: AddressSanitizer: container-overflow on address 0x60800002e4e8 at pc 0x562899512022 bp 0x7ffc0ad94d10 sp 0x7ffc0ad944c0<br>READ of size 24 at 0x60800002e4e8 thread T0<br>    #0 0x562899512021 in __asan_memcpy (MyProgram+0x22c7021)<br>    #1 0x562899609a51 in std::string::basic_string(std::string&&) /usr/include/c++/v1/string:1683:7<br>    #2 0x562899609a51 in void std::allocator<std::string>::construct<std::string, std::string >(std::string*, std::string&&) /usr/include/c++/v1/memory:1805<br>    #3 0x562899609a51 in void std::allocator_traits<std::allocator<std::string> >::__construct<std::string, std::string >(std::__1::integral_constant<bool, true>, std::allocator<std::string>&, std::string*, std::string&&) /usr/include/c++/v1/memory:1715<br>    #4 0x562899609a51 in void std::allocator_traits<std::allocator<std::string> >::construct<std::string, std::string >(std::allocator<std::string>&, std::string*, std::string&&) /usr/include/c++/v1/memory:1561<br>    #5 0x562899609a51 in void std::allocator_traits<std::allocator<std::string> >::__construct_backward<std::string*>(std::allocator<std::string>&, std::string*, std::string*, std::string*&) /usr/include/c++/v1/memory:1677<br>    #6 0x562899609a51 in std::__1::vector<std::string, std::allocator<std::string> >::__swap_out_circular_buffer(std::__1::__split_buffer<std::string, std::allocator<std::string>&>&) /usr/include/c++/v1/vector:898<br>    #7 0x562899608928 in void std::__1::vector<std::string, std::allocator<std::string> >::__push_back_slow_path<std::string const&>(std::string const&) /usr/include/c++/v1/vector:1582:5<br>    #8 0x56289f792aa9 in std::__1::vector<std::string, std::allocator<std::string> >::push_back(std::string const&) /usr/include/c++/v1/vector:1599:9<br>    #9 0x56289f792aa9 in MyLibrary::DoSomethingUseful(std::vector<std::string>&, std::string const&) <br></div><div><br></div><div>It's not reasonable for me to suppress everything that might happen in libc++, because I might have an actual violation which occurs from instrumented code.  </div><div><br></div><div>I can disable container-overflow but that seems suboptimal too.</div><div><br></div><div>Is there a good workaround for this situation?  Ideally I'd like to use an LSAN-style suppression that allows me to match anywhere in the callstack, but this doesn't appear to be supported.</div><div><br></div><div>Advice appreciated.</div></div>