Fix check of pixelMap

Signed-off-by: wuliangdong <wuliangdong1@huawei.com>
Change-Id: Ib5fbdd96774aaf164a4f15d4ea3f93eb8fb6bda7
This commit is contained in:
wuliangdong 2023-11-28 07:22:08 +00:00
parent 9e182b9eea
commit b998b6de21
3 changed files with 4 additions and 0 deletions

View File

@ -487,6 +487,7 @@ void InteractionManagerTest::PrintDragData(const DragData &dragData)
{
CALL_DEBUG_ENTER;
for (const auto &shadowInfo : dragData.shadowInfos) {
CHKPV(shadowInfo.pixelMap);
FI_HILOGD("PixelFormat:%{public}d, PixelAlphaType:%{public}d, PixelAllocatorType:%{public}d,"
" PixelWidth:%{public}d, PixelHeight:%{public}d, shadowX:%{public}d, shadowY:%{public}d",
static_cast<int32_t>(shadowInfo.pixelMap->GetPixelFormat()),

View File

@ -433,6 +433,7 @@ int32_t DeviceStatusSrvStub::StartDragStub(MessageParcel& data, MessageParcel& r
return E_DEVICESTATUS_READ_PARCEL_ERROR;
}
for (const auto& shadowInfo : dragData.shadowInfos) {
CHKPR(shadowInfo.pixelMap, RET_ERR);
if ((shadowInfo.x > 0) || (shadowInfo.y > 0) ||
(shadowInfo.x < -shadowInfo.pixelMap->GetWidth()) || (shadowInfo.y < -shadowInfo.pixelMap->GetHeight())) {
FI_HILOGE("Invalid parameter, shadowInfox:%{public}d, shadowInfoy:%{public}d", shadowInfo.x, shadowInfo.y);
@ -551,6 +552,7 @@ int32_t DeviceStatusSrvStub::UpdateShadowPicStub(MessageParcel& data, MessagePar
shadowInfo.pixelMap = std::shared_ptr<OHOS::Media::PixelMap>(pixelMap);
READINT32(data, shadowInfo.x, E_DEVICESTATUS_READ_PARCEL_ERROR);
READINT32(data, shadowInfo.y, E_DEVICESTATUS_READ_PARCEL_ERROR);
CHKPR(shadowInfo.pixelMap, RET_ERR);
if ((shadowInfo.x > 0) || (shadowInfo.y > 0) ||
(shadowInfo.x < -shadowInfo.pixelMap->GetWidth()) ||
(shadowInfo.y < -shadowInfo.pixelMap->GetHeight())) {

View File

@ -125,6 +125,7 @@ void DragManager::PrintDragData(const DragData &dragData)
{
CALL_INFO_TRACE;
for (const auto& shadowInfo : dragData.shadowInfos) {
CHKPV(shadowInfo.pixelMap);
FI_HILOGI("PixelFormat:%{public}d, PixelAlphaType:%{public}d, PixelAllocatorType:%{public}d,"
" PixelWidth:%{public}d, PixelHeight:%{public}d, shadowX:%{public}d, shadowY:%{public}d",
static_cast<int32_t>(shadowInfo.pixelMap->GetPixelFormat()),