OSDN Git Service

Fix SF security vulnerability: 32706020
authorFabien Sanglard <sanglardf@google.com>
Tue, 8 Nov 2016 23:35:02 +0000 (15:35 -0800)
committerFabien Sanglard <sanglardf@google.com>
Wed, 9 Nov 2016 17:25:44 +0000 (17:25 +0000)
Because of lack of mutex lock when get mConsumerName, if one thread
getConsumerName, another thread setConsumerName frequently, an UAF will
be triggered.

Change-Id: Id1bbf0d15de6d16def2f54ecade385058cda3b65
Test: Marling with poc provided in bug report.
Bug: 32706020

libs/gui/BufferQueueProducer.cpp

index 87e5b4d..c6851c8 100644 (file)
@@ -1091,6 +1091,7 @@ status_t BufferQueueProducer::setGenerationNumber(uint32_t generationNumber) {
 
 String8 BufferQueueProducer::getConsumerName() const {
     ATRACE_CALL();
+    Mutex::Autolock lock(mCore->mMutex);
     BQ_LOGV("getConsumerName: %s", mConsumerName.string());
     return mConsumerName;
 }