Azure / azure-storage-cpp

Microsoft Azure Storage Client Library for C++
http://azure.github.io/azure-storage-cpp
Apache License 2.0
132 stars 148 forks source link

Segfault (SIGSEGV) when accessing non-existent Storage account #387

Closed santowiryaman closed 3 years ago

santowiryaman commented 3 years ago

Our system suffers SIGSEGV when trying to access a non-existing Storage Account. This can happen when the SA is deleted e.g. using the Azure portal. Protecting the access with try-catch does not work. I can reproduce this using the simple example program in this blob tutorial. If the SA name and key are valid, the code (see attached) works. But if you replace the SA name with one that does not exist, we get a SIGSEGV.

Two questions:

  1. What is the best way to test if an SA exist or not
  2. How to avoid this SIGSEGV

The stack trace showed that the host is not valid which is correct because the SA does not exist. But the len passed to strncpy is garbage: 93,824,992,380,586 ?? () boost::system::error_category::message (this=0x55555558c490 <boost::asio::error::get_netdb_category()::instance>, ev=1, buffer=0x7ffff317a9a0 \"Host not found (authoritative)\", len=93824992380586) web::http::client::details::asio_context::report_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::system::error_code const&, web::http::client::details::httpclient_errorcode_context) () ?? ()

Thank you. -santo

santowiryaman commented 3 years ago

Update: It turned out that this was caused by version mismatch of Boost when we built the cpprest library. After fixing that, the crash problem went away.