diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-04-07 01:07:11 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-04-07 01:07:11 +0000 |
commit | aa0540c86a939e6c0f63e17d13d2aed3d9b53777 (patch) | |
tree | c046c8537fd30bad7f4a0254d8cfd3b51e2bc6f2 /drm/1.0/default/CryptoPlugin.cpp | |
parent | a43eff3d6efec6cbaf0863d390dc9b4bd58bdaa1 (diff) | |
parent | fa75337fa30e6215f3a7c1948201daf2f316dd8a (diff) |
Snap for 7263361 from fa75337fa30e6215f3a7c1948201daf2f316dd8a to sc-release
Change-Id: I8172347dc846d03c09e5eb97bea9c83e20c76d75
Diffstat (limited to 'drm/1.0/default/CryptoPlugin.cpp')
-rw-r--r-- | drm/1.0/default/CryptoPlugin.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drm/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp index de8bbd599c..8dea7e9324 100644 --- a/drm/1.0/default/CryptoPlugin.cpp +++ b/drm/1.0/default/CryptoPlugin.cpp @@ -148,7 +148,10 @@ namespace implementation { return Void(); } - if (destBuffer.offset + destBuffer.size > destBase->getSize()) { + size_t totalSize = 0; + if (__builtin_add_overflow(destBuffer.offset, destBuffer.size, &totalSize) || + totalSize > destBase->getSize()) { + android_errorWriteLog(0x534e4554, "176496353"); _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size"); return Void(); } @@ -159,7 +162,7 @@ namespace implementation { } base = static_cast<uint8_t *>(static_cast<void *>(destBase->getPointer())); - destPtr = static_cast<void *>(base + destination.nonsecureMemory.offset); + destPtr = static_cast<void*>(base + destination.nonsecureMemory.offset); } else if (destination.type == BufferType::NATIVE_HANDLE) { if (!secure) { _hidl_cb(Status::BAD_VALUE, 0, "native handle destination must be secure"); |