commit | 107233b3ddf157b4a009faca90e9490bfa67aa6d | [log] [tgz] |
---|---|---|
author | Edwin Wong <edwinwong@google.com> | Wed Feb 03 23:09:55 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Feb 03 23:09:55 2021 +0000 |
tree | d7e1a95e7f52b34aa8f829eee1f4094ff3c9a8ed | |
parent | 6e8a31191ae1e0ef3d04c042443ab5b8a774d279 [diff] | |
parent | c14f262876818498b3ca77f1d6df9d4fb7e77b1c [diff] |
Fix potential decrypt src pointer overflow. am: c14f262876 Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/13472562 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I58ba75466b6851265836a1db65654eb63f18c793
diff --git a/drm/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp index 2db3607..e6d4e84 100644 --- a/drm/1.0/default/CryptoPlugin.cpp +++ b/drm/1.0/default/CryptoPlugin.cpp
@@ -124,7 +124,11 @@ return Void(); } - if (source.offset + offset + source.size > sourceBase->getSize()) { + size_t totalSize = 0; + if (__builtin_add_overflow(source.offset, offset, &totalSize) || + __builtin_add_overflow(totalSize, source.size, &totalSize) || + totalSize > sourceBase->getSize()) { + android_errorWriteLog(0x534e4554, "176496160"); _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size"); return Void(); }