Merge RQ2A.210405.006 to aosp-master - DO NOT MERGE

Merged-In: Ib56dbbc032236ffe012f36dfb83040b06847f455
Merged-In: Ia036416d8c0c90400586f9573c3be66b2ff8ea03
Change-Id: I09f542101304af38614d9d3715c25480bbef6c96
This commit is contained in:
Bill Yi
2021-04-13 19:29:20 -07:00

View File

@@ -124,7 +124,11 @@ namespace implementation {
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();
}