!1231 为手势动画ipc通信增加vector校验

Merge pull request !1231 from chenhaiying/m4
This commit is contained in:
openharmony_ci
2022-07-23 07:58:10 +00:00
committed by Gitee
2 changed files with 5 additions and 18 deletions
+4 -14
View File
@@ -590,22 +590,12 @@ void WindowManagerProxy::MinimizeWindowsByLauncher(std::vector<uint32_t> windowI
WLOGFE("WriteInterfaceToken failed");
return;
}
auto size = static_cast<uint32_t>(windowIds.size());
const uint32_t maxWindowNum = 100;
if (size > maxWindowNum) {
WLOGFE("windowNum cannot exceeds than 100");
if (!data.WriteUInt32Vector(windowIds)) {
WLOGFE("Write windowIds failed");
return;
}
if (!data.WriteUint32(size)) {
WLOGFE("Write windowNum failed");
return;
}
for (auto id : windowIds) {
if (!data.WriteUint32(id)) {
WLOGFE("Write windowId failed");
return;
}
}
if (!data.WriteBool(isAnimated)) {
WLOGFE("Write isAnimated failed");
return;
+1 -4
View File
@@ -201,10 +201,7 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M
}
case WindowManagerMessage::TRANS_ID_GET_ANIMATION_CALLBACK: {
std::vector<uint32_t> windowIds;
uint32_t windowNum = data.ReadUint32();
for (uint32_t i = 0; i < windowNum; ++i) {
windowIds.push_back(data.ReadUint32());
}
data.ReadUInt32Vector(&windowIds);
bool isAnimated = data.ReadBool();
sptr<RSIWindowAnimationFinishedCallback> finishedCallback = nullptr;
MinimizeWindowsByLauncher(windowIds, isAnimated, finishedCallback);