diff --git a/libwvdrmengine/mediacrypto/src_hidl/WVCryptoPlugin.cpp b/libwvdrmengine/mediacrypto/src_hidl/WVCryptoPlugin.cpp index 3cd7a265..61846c01 100644 --- a/libwvdrmengine/mediacrypto/src_hidl/WVCryptoPlugin.cpp +++ b/libwvdrmengine/mediacrypto/src_hidl/WVCryptoPlugin.cpp @@ -152,7 +152,11 @@ Return WVCryptoPlugin::decrypt( return Void(); } - if (source.offset + offset + source.size > sourceBase->getSize()) { + size_t totalSrcSize = 0; + if (__builtin_add_overflow(source.offset, offset, &totalSrcSize) || + __builtin_add_overflow(totalSrcSize, source.size, &totalSrcSize) || + totalSrcSize > sourceBase->getSize()) { + android_errorWriteLog(0x534e4554, "176496160"); _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size"); return Void(); }