summaryrefslogtreecommitdiffstats
path: root/drm
diff options
context:
space:
mode:
authorEdwin Wong <edwinwong@google.com>2019-11-26 17:52:52 -0800
committerEdwin Wong <edwinwong@google.com>2020-01-08 01:29:58 +0000
commitb92e3bf778ab8dcf28193cfb63c40dd964644c47 (patch)
tree6264825f410a8c258c40002cedeb448869b1c2b4 /drm
parent7b254210fe701b9023d1db342c6d1c884d39efe7 (diff)
downloadframeworks_av-b92e3bf778ab8dcf28193cfb63c40dd964644c47.tar.gz
frameworks_av-b92e3bf778ab8dcf28193cfb63c40dd964644c47.tar.bz2
frameworks_av-b92e3bf778ab8dcf28193cfb63c40dd964644c47.zip
[DO NOT MERGE] Fix heap buffer overflow for releaseSecureStops.
If the input SecureStopRelease size is less than sizeof(uint32_t) in releaseSecureStops(), an out of bound read will occur. bug: 144766455 bug: 144746235 bug: 147281068 Test: sts ANDROID_BUILD_TOP= ./android-sts/tools/sts-tradefed run sts-engbuild-no-spl-lock -m StsHostTestCases --test android.security.sts.Poc19_11#testPocBug_144766455 Change-Id: Ibee5a105eaedfee37d2fa93f7024f63f30cc7409
Diffstat (limited to 'drm')
-rw-r--r--drm/mediadrm/plugins/clearkey/hidl/DrmPlugin.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/drm/mediadrm/plugins/clearkey/hidl/DrmPlugin.cpp b/drm/mediadrm/plugins/clearkey/hidl/DrmPlugin.cpp
index d74bc53d8b..7cb5a38f35 100644
--- a/drm/mediadrm/plugins/clearkey/hidl/DrmPlugin.cpp
+++ b/drm/mediadrm/plugins/clearkey/hidl/DrmPlugin.cpp
@@ -809,6 +809,11 @@ Return<Status> DrmPlugin::releaseSecureStops(const SecureStopRelease& ssRelease)
// count - number of secure stops
// list of fixed length secure stops
size_t countBufferSize = sizeof(uint32_t);
+ if (input.size() < countBufferSize) {
+ // SafetyNet logging
+ android_errorWriteLog(0x534e4554, "144766455");
+ return Status::BAD_VALUE;
+ }
uint32_t count = 0;
sscanf(reinterpret_cast<char*>(input.data()), "%04" PRIu32, &count);