diff --git a/frameworks/c/drm_capi/native_mediakeysession.cpp b/frameworks/c/drm_capi/native_mediakeysession.cpp index 240d52e1b57c4568cc8d2e2b0fe7e5d56410ac25..c5383c660dec86d89401f414da3aed912fe4abff 100644 --- a/frameworks/c/drm_capi/native_mediakeysession.cpp +++ b/frameworks/c/drm_capi/native_mediakeysession.cpp @@ -191,8 +191,38 @@ Drm_ErrCode OH_MediaKeySession_ClearMediaKeys(MediaKeySession *mediaKeySessoin) Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest(MediaKeySession *mediaKeySessoin, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseRequest, int32_t *releaseRequestLen) -{ +{ + if (mediaKeySession == nullptr) { + DRM_INFO_LOG("mediaKeySession is nullptr1"); + return DRM_ERR_INVALID_VAL; +} + +if (offlineMediaKeyId == nullptr) { + DRM_INFO_LOG("offlineMediaKeyId is nullptr1"); + return DRM_ERR_INVALID_VAL; +} + +if (offlineMediaKeyIdLen == nullptr) { + DRM_INFO_LOG("offlineMediaKeyIdLen is nullptr1"); + return DRM_ERR_INVALID_VAL; +} + +if (*offlineMediaKeyIdLen <= 0 || *offlineMediaKeyIdLen > MAX_OFFLINE_MEDIA_KEY_ID_LEN) { + DRM_INFO_LOG("offlineMediaKeyIdLen is invalid: %d", *offlineMediaKeyIdLen); + return DRM_ERR_INVALID_VAL; +} + +if (releaseRequest == nullptr) { + DRM_INFO_LOG("releaseRequest is nullptr1"); + return DRM_ERR_INVALID_VAL; +} + +if (releaseRequestLen == nullptr) { + DRM_INFO_LOG("releaseRequestLen is nullptr1"); + return DRM_ERR_INVALID_VAL; +} DRM_INFO_LOG("OH_MediaKeySession_GenerateOfflineReleaseRequest enter"); + DRM_CHECK_AND_RETURN_RET_LOG(((mediaKeySessoin != nullptr) && (offlineMediaKeyId != nullptr) && (offlineMediaKeyIdLen > 0) && (offlineMediaKeyIdLen <= MAX_OFFLINE_MEDIA_KEY_ID_LEN) && (releaseRequest != nullptr) && (releaseRequestLen != nullptr)), diff --git a/frameworks/js/drm_napi/native_module_ohos_drm.cpp b/frameworks/js/drm_napi/native_module_ohos_drm.cpp index 56ad0d70cacd5ad895ba620a50c61078cfca311f..20bd56575e90be7bbd9db76e41a0b7f4961e5921 100644 --- a/frameworks/js/drm_napi/native_module_ohos_drm.cpp +++ b/frameworks/js/drm_napi/native_module_ohos_drm.cpp @@ -27,6 +27,7 @@ static napi_value Export(napi_env env, napi_value exports) MediaKeySessionNapi::Init(env, exports); MediaKeySystemNapi::Init(env, exports); return exports; + } /*