!1207 无障碍修改校验外部读入数据,修改部分日志

Merge pull request !1207 from qianchuang/master
This commit is contained in:
openharmony_ci 2024-07-10 13:48:15 +00:00 committed by Gitee
commit 43eb51799c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 23 additions and 6 deletions

View File

@ -115,7 +115,10 @@ ErrCode AccessibilityElementOperatorCallbackStub::HandleSetSearchElementInfoByAc
int32_t accessibilityInfosize = data.ReadInt32();
std::vector<AccessibilityElementInfo> tmpData;
ContainerSecurityVerify(data, accessibilityInfosize, tmpData.max_size());
bool verifyResult = ContainerSecurityVerify(data, accessibilityInfosize, tmpData.max_size());
if (!verifyResult || accessibilityInfosize < 0 || accessibilityInfosize > INT32_MAX) {
return TRANSACTION_ERR;
}
for (int32_t i = 0; i < accessibilityInfosize; i++) {
sptr<AccessibilityElementInfoParcel> accessibilityInfo =
data.ReadStrongParcelable<AccessibilityElementInfoParcel>();
@ -147,7 +150,10 @@ ErrCode AccessibilityElementOperatorCallbackStub::HandleSetSearchElementInfoByTe
HILOG_DEBUG();
std::vector<AccessibilityElementInfo> infos {};
int32_t accessibilityInfosize = data.ReadInt32();
ContainerSecurityVerify(data, accessibilityInfosize, infos.max_size());
bool verifyResult = ContainerSecurityVerify(data, accessibilityInfosize, infos.max_size());
if (!verifyResult || accessibilityInfosize < 0 || accessibilityInfosize > INT32_MAX) {
return TRANSACTION_ERR;
}
for (int32_t i = 0; i < accessibilityInfosize; i++) {
sptr<AccessibilityElementInfoParcel> accessibilityInfo =
data.ReadStrongParcelable<AccessibilityElementInfoParcel>();

View File

@ -383,7 +383,10 @@ ErrCode AccessibleAbilityChannelStub::HandleSetTargetBundleName(MessageParcel &d
HILOG_DEBUG();
std::vector<std::string> targetBundleNames;
int32_t size = data.ReadInt32();
ContainerSecurityVerify(data, size, targetBundleNames.max_size());
bool verifyResult = ContainerSecurityVerify(data, size, targetBundleNames.max_size());
if (!verifyResult || size < 0 || size > INT32_MAX) {
return TRANSACTION_ERR;
}
for (int32_t i = 0; i < size; i++) {
std::string temp = data.ReadString();
targetBundleNames.emplace_back(temp);

View File

@ -57,7 +57,10 @@ bool AccessibilityElementInfoParcel::ReadFromParcelSecondPart(Parcel &parcel)
{
int32_t operationsSize = 0;
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, operationsSize);
ContainerSecurityVerify(parcel, operationsSize, operations_.max_size());
bool verifyResult = ContainerSecurityVerify(parcel, operationsSize, operations_.max_size());
if (!verifyResult || operationsSize < 0 || operationsSize > INT32_MAX) {
return false;
}
for (int32_t i = 0; i < operationsSize; i++) {
sptr<AccessibleActionParcel> accessibleOperation = parcel.ReadStrongParcelable<AccessibleActionParcel>();
if (!accessibleOperation) {

View File

@ -74,7 +74,9 @@ bool AccessibilityEventInfoParcel::ReadFromParcelSecondPart(Parcel &parcel)
int32_t contentSize = 0;
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, contentSize);
std::string content;
ContainerSecurityVerify(parcel, contentSize, contents_.max_size());
if (!ContainerSecurityVerify(parcel, contentSize, contents_.max_size())) {
return false;
}
for (auto i = 0 ; i < contentSize; i++) {
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, content);
AddContent(content);

View File

@ -30,7 +30,10 @@ bool AccessibilityGestureInjectPathParcel::ReadFromParcel(Parcel &parcel)
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int64, parcel, durationTime_);
int32_t positionSize = 0;
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, positionSize);
ContainerSecurityVerify(parcel, positionSize, positions_.max_size());
bool verifyResult = ContainerSecurityVerify(parcel, positionSize, positions_.max_size());
if (!verifyResult || positionSize < 0 || positionSize > INT32_MAX) {
return false;
}
for (auto i = 0; i < positionSize; i++) {
AccessibilityGesturePosition position;
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Float, parcel, position.positionX_);