diff options
author | Chia-I Wu <olv@google.com> | 2017-05-15 10:32:27 -0700 |
---|---|---|
committer | MSe <mse1969@posteo.de> | 2017-07-06 21:41:47 +0200 |
commit | ea0521baee31e4b98caeab665e39610f67c3f035 (patch) | |
tree | 88b318e878b63e95525dd2ab0825a559c23e332c | |
parent | a3a09ef6b40ffc44c6d17a2d8d798fbd19456c59 (diff) | |
download | frameworks_native-ea0521baee31e4b98caeab665e39610f67c3f035.tar.gz frameworks_native-ea0521baee31e4b98caeab665e39610f67c3f035.tar.bz2 frameworks_native-ea0521baee31e4b98caeab665e39610f67c3f035.zip |
libgui: check for invalid slot in attachBuffer
Bug: 37478824
Test: manual
AOSP-Change-Id: I369337d53539bf7f7e3d925bccdae4045da1b404
(cherry picked from commit c79a29689c1046f1f0301c75df9b9a67cba8bf04)
CVE-2017-0667
Change-Id: I15290a700c2e0f0da9a44bb3131c4e38cadbaed3
-rw-r--r-- | libs/gui/IGraphicBufferProducer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp index c3c62358f..51eedab3d 100644 --- a/libs/gui/IGraphicBufferProducer.cpp +++ b/libs/gui/IGraphicBufferProducer.cpp @@ -26,6 +26,7 @@ #include <binder/Parcel.h> #include <binder/IInterface.h> +#include <gui/BufferQueueDefs.h> #include <gui/IGraphicBufferProducer.h> #include <gui/IProducerListener.h> @@ -170,8 +171,16 @@ public: if (result != NO_ERROR) { return result; } + *slot = reply.readInt32(); result = reply.readInt32(); + if (result == NO_ERROR && + (*slot < 0 || *slot >= BufferQueueDefs::NUM_BUFFER_SLOTS)) { + ALOGE("attachBuffer returned invalid slot %d", *slot); + android_errorWriteLog(0x534e4554, "37478824"); + return UNKNOWN_ERROR; + } + return result; } |