diff --git a/libwvdrmengine/mediacrypto/src_hidl/WVCryptoPlugin.cpp b/libwvdrmengine/mediacrypto/src_hidl/WVCryptoPlugin.cpp index 6a719f92..cef2933e 100644 --- a/libwvdrmengine/mediacrypto/src_hidl/WVCryptoPlugin.cpp +++ b/libwvdrmengine/mediacrypto/src_hidl/WVCryptoPlugin.cpp @@ -192,7 +192,11 @@ Return WVCryptoPlugin::decrypt_1_2( 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_V1_2::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size"); return Void(); }