Details
Description
from the mailing list: http://lists.qt-project.org/pipermail/qtwebengine/2016-October/000399.html
The qtwebengine(widget) demo browser works for all general operations except it crashes at http://html5test.com while running HTML5Test.
With QTCreator remote debugger, I found that the program was crashed at
void ClientUsageTracker::AddCachedOrigin(const GURL& origin, int64 new_usage) { DCHECK(IsUsageCacheEnabledForOrigin(origin)); std::string host = net::GetHostOrSpecFromURL(origin); int64* usage = &cached_usage_by_host_[host][origin]; // LAST INSTRUCTION int64 delta = new_usage - *usage; *usage = new_usage; if (delta) { if (IsStorageUnlimited(origin)) global_unlimited_usage_ += delta; else global_limited_usage_ += delta; } DCHECK_GE(*usage, 0); DCHECK_GE(global_limited_usage_, 0); }
Which can be traced to the segment fault occurs at
linaro-2016.02/arm-linux-gnueabihf/include/c++/5.3.1/bits/basic_string.h (109)
template<typename _CharT, typename _Traits, typename _Alloc> class basic_string { ... // Use empty-base optimization: http://www.cantrip.org/emptyopt.html struct _Alloc_hider : allocator_type // TODO check __is_final { _Alloc_hider(pointer __dat, const _Alloc& __a = _Alloc()) : allocator_type(__a), _M_p(__dat) { } ... }
The QT5 Webengine demo program crashes due to a std::map related memory allocation problem at the C++ class ClientUsageTracker where this class is only used by the html5 test code at http://html5test.com.
I am able to add the std::map test code at various places such as the demo program, qtwebengine module, other chromium module such as the “cert verify openssl” module and they all work fine. However, the demo program crashes when I add the similar test code at the module ClientUsageTracker.
typedef std::map<std::string, int64_t> UsageMap2; ClientUsageTracker::ClientUsageTracker(UsageTracker* tracker, QuotaClient* client, StorageType type, SpecialStoragePolicy* special_storage_policy, StorageMonitor* storage_monitor) : tracker_(tracker), client_(client), type_(type), storage_monitor_(storage_monitor), global_limited_usage_(0), global_unlimited_usage_(0), global_usage_retrieved_(false), special_storage_policy_(special_storage_policy) { cout << "ClientUsageTracker::ClientUsageTracker" << endl; #if 0 UsageMap2 temp; int64_t *t = &temp["Hello"]; *t = 110; cout << "lientUsageTracker::ClientUsageTracker = " << *t <<endl; #endif DCHECK(tracker_); DCHECK(client_); if (special_storage_policy_.get()) special_storage_policy_->AddObserver(this); }