From 654b5775e17bf14f0a5d6dad7d86927698ae833a Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 10 Jun 2019 15:05:34 -0700 Subject: [PATCH] Crash fix for ResourceCache::getResource() A wrong 'read' locker is used around a critical section that actually modifies the _resources QHash. This can result in memory corruption and seg faults. --- libraries/networking/src/ResourceCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/ResourceCache.cpp b/libraries/networking/src/ResourceCache.cpp index 44d3d1ee4d..ef8a7b577d 100644 --- a/libraries/networking/src/ResourceCache.cpp +++ b/libraries/networking/src/ResourceCache.cpp @@ -346,7 +346,7 @@ void ResourceCache::setRequestLimit(uint32_t limit) { QSharedPointer ResourceCache::getResource(const QUrl& url, const QUrl& fallback, void* extra, size_t extraHash) { QSharedPointer resource; { - QReadLocker locker(&_resourcesLock); + QWriteLocker locker(&_resourcesLock); auto& resourcesWithExtraHash = _resources[url]; auto resourcesWithExtraHashIter = resourcesWithExtraHash.find(extraHash); if (resourcesWithExtraHashIter != resourcesWithExtraHash.end()) {