Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return CONSTRAINT_ERROR on user labels that are too long (instead of FAILURE) #20553

Merged
merged 6 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/clusters/user-label-server/user-label-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ CHIP_ERROR UserLabelAttrAccess::WriteLabelList(const ConcreteDataAttributePath &
LabelList::TypeInfo::DecodableType decodablelist;

ReturnErrorOnFailure(aDecoder.Decode(decodablelist));
ReturnErrorCodeIf(!IsValidLabelEntryList(decodablelist), CHIP_ERROR_INVALID_ARGUMENT);
ReturnErrorCodeIf(!IsValidLabelEntryList(decodablelist), CHIP_IM_GLOBAL_STATUS(ConstraintError));

auto iter = decodablelist.begin();
while (iter.Next())
Expand All @@ -146,7 +146,7 @@ CHIP_ERROR UserLabelAttrAccess::WriteLabelList(const ConcreteDataAttributePath &
Structs::LabelStruct::DecodableType entry;

ReturnErrorOnFailure(aDecoder.Decode(entry));
ReturnErrorCodeIf(!IsValidLabelEntry(entry), CHIP_ERROR_INVALID_ARGUMENT);
ReturnErrorCodeIf(!IsValidLabelEntry(entry), CHIP_IM_GLOBAL_STATUS(ConstraintError));

return provider->AppendUserLabel(endpoint, entry);
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/suites/TestUserLabelClusterConstraints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tests:
},
]
response:
error: FAILURE
error: CONSTRAINT_ERROR

- label: "Attempt to write overly long item for value"
command: "writeAttribute"
Expand All @@ -54,4 +54,4 @@ tests:
},
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
]
response:
error: FAILURE
error: CONSTRAINT_ERROR
4 changes: 2 additions & 2 deletions src/app/tests/suites/certification/Test_TC_ULABEL_2_3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tests:
},
]
response:
error: FAILURE
error: CONSTRAINT_ERROR

- label: "TH reads LabelList attribute of the DUT"
PICS: ULABEL.S.A0000
Expand All @@ -59,4 +59,4 @@ tests:
},
]
response:
error: FAILURE
error: CONSTRAINT_ERROR
8 changes: 4 additions & 4 deletions zzz_generated/chip-tool/zap-generated/test/Commands.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.