mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-30 10:32:20 +00:00
add check data valid when read pacel data
Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
parent
02043634f9
commit
2a27f272fe
@ -84,10 +84,6 @@ ErrCode AccessibilityElementOperatorCallbackStub::HandleSetSearchElementInfoByAc
|
||||
|
||||
HILOG_DEBUG("dataSize: %{public}d, offsetSize: %{public}d, elementSize: %{public}d",
|
||||
data.GetDataSize(), data.GetOffsetsSize(), accessibilityInfosize * sizeof(AccessibilityElementInfo));
|
||||
if (data.GetDataSize() - data.GetOffsetsSize() < accessibilityInfosize * sizeof(AccessibilityElementInfo)) {
|
||||
HILOG_ERROR("ReadParcelable invalid size");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
for (int i = 0; i < accessibilityInfosize; i++) {
|
||||
sptr<AccessibilityElementInfo> accessibilityInfo = data.ReadStrongParcelable<AccessibilityElementInfo>();
|
||||
@ -117,10 +113,6 @@ ErrCode AccessibilityElementOperatorCallbackStub::HandleSetSearchElementInfoByTe
|
||||
|
||||
HILOG_DEBUG("dataSize: %{public}d, offsetSize: %{public}d, elementSize: %{public}d",
|
||||
data.GetDataSize(), data.GetOffsetsSize(), accessibilityInfosize * sizeof(AccessibilityElementInfo));
|
||||
if (data.GetDataSize() - data.GetOffsetsSize() < accessibilityInfosize * sizeof(AccessibilityElementInfo)) {
|
||||
HILOG_ERROR("ReadParcelable invalid size");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
for (int i = 0; i < accessibilityInfosize; i++) {
|
||||
sptr<AccessibilityElementInfo> accessibilityInfo = data.ReadStrongParcelable<AccessibilityElementInfo>();
|
||||
|
@ -351,10 +351,6 @@ ErrCode AccessibleAbilityChannelStub::HandleSendSimulateGesture(MessageParcel &d
|
||||
|
||||
HILOG_DEBUG("dataSize: %{public}d, offsetSize: %{public}d, elementSize: %{public}d",
|
||||
data.GetDataSize(), data.GetOffsetsSize(), stepSize * sizeof(GesturePathDefine));
|
||||
if (data.GetDataSize() - data.GetOffsetsSize() < stepSize * sizeof(GesturePathDefine)) {
|
||||
HILOG_ERROR("ReadParcelable invalid size");
|
||||
return ERROR;
|
||||
}
|
||||
for (int32_t i = 0; i < stepSize; i++) {
|
||||
std::shared_ptr<GesturePathDefine> gestureStep(data.ReadParcelable<GesturePathDefine>());
|
||||
if (!gestureStep) {
|
||||
|
@ -50,6 +50,10 @@ ErrCode AccessibleAbilityManagerServiceCaptionPropertyStub::HandleOnCaptionPrope
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
CaptionProperty* caption = data.ReadParcelable<CaptionProperty>();
|
||||
if (!caption) {
|
||||
HILOG_ERROR("ReadParcelable<CaptionProperty> failed");
|
||||
return ERROR;
|
||||
}
|
||||
OnCaptionPropertyChanged(*caption);
|
||||
|
||||
return NO_ERROR;
|
||||
|
@ -666,6 +666,10 @@ std::map<std::string, AppExecFwk::ElementName> AccessibleAbilityManagerServiceCl
|
||||
std::vector<AppExecFwk::ElementName> temp {};
|
||||
for (int i = dev_num; i > 0; i--) {
|
||||
std::unique_ptr<AppExecFwk::ElementName> iter(reply.ReadParcelable<AppExecFwk::ElementName>());
|
||||
if (!iter) {
|
||||
HILOG_ERROR("ReadParcelable<AppExecFwk::ElementName> failed");
|
||||
return it;
|
||||
}
|
||||
temp.push_back(*iter);
|
||||
}
|
||||
|
||||
@ -698,6 +702,10 @@ std::vector<AccessibilityAbilityInfo> AccessibleAbilityManagerServiceClientProxy
|
||||
int dev_num = reply.ReadInt32();
|
||||
for (int i = dev_num; i > 0; i--) {
|
||||
std::unique_ptr<AccessibilityAbilityInfo> dev(reply.ReadParcelable<AccessibilityAbilityInfo>());
|
||||
if (!dev) {
|
||||
HILOG_ERROR("ReadParcelable<accessibilityAbilityInfo> failed");
|
||||
return it;
|
||||
}
|
||||
it.push_back(*dev);
|
||||
}
|
||||
return it;
|
||||
|
@ -347,14 +347,13 @@ ErrCode AccessibleAbilityManagerServiceClientStub::HandleSetEnabledObj(MessagePa
|
||||
}
|
||||
HILOG_DEBUG("dataSize: %{public}d, offsetSize: %{public}d, elementSize: %{public}d",
|
||||
data.GetDataSize(), data.GetOffsetsSize(), dev_num * sizeof(AppExecFwk::ElementName));
|
||||
if (data.GetDataSize() - data.GetOffsetsSize() < dev_num * sizeof(AppExecFwk::ElementName)) {
|
||||
HILOG_ERROR("ReadParcelable invalid size");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
std::vector<AppExecFwk::ElementName> temp {};
|
||||
for (int i = dev_num; i > 0; i--) {
|
||||
std::unique_ptr<AppExecFwk::ElementName> iter(data.ReadParcelable<AppExecFwk::ElementName>());
|
||||
if (!iter) {
|
||||
HILOG_ERROR("ReadParcelable<AppExecFwk::ElementName> failed");
|
||||
return ERROR;
|
||||
}
|
||||
temp.push_back(*iter);
|
||||
}
|
||||
for (int i = 0; i < dev_num; i++) {
|
||||
@ -413,14 +412,13 @@ ErrCode AccessibleAbilityManagerServiceClientStub::HandleDisableAbilities(Messag
|
||||
}
|
||||
HILOG_DEBUG("dataSize: %{public}d, offsetSize: %{public}d, elementSize: %{public}d",
|
||||
data.GetDataSize(), data.GetOffsetsSize(), dev_num * sizeof(AppExecFwk::ElementName));
|
||||
if (data.GetDataSize() - data.GetOffsetsSize() < dev_num * sizeof(AppExecFwk::ElementName)) {
|
||||
HILOG_ERROR("ReadParcelable invalid size");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
std::vector<AppExecFwk::ElementName> temp {};
|
||||
for (int i = dev_num; i > 0; i--) {
|
||||
std::unique_ptr<AppExecFwk::ElementName> iter(data.ReadParcelable<AppExecFwk::ElementName>());
|
||||
if (!iter) {
|
||||
HILOG_ERROR("ReadParcelable<AppExecFwk::ElementName> failed");
|
||||
return ERROR;
|
||||
}
|
||||
temp.push_back(*iter);
|
||||
}
|
||||
for (int i = 0; i < dev_num; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user