-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Bogus cast introduced in PR 6690 #6801
Comments
This issue was introduced from #6596.
Is this addition valid? |
And if the new cluster had been added to Also would have been good to add to |
It's correct for OCTET_STRING. CHAR_STRING, again, is not supported in structs yet. |
My new cluster does not get added to chip-tool, this issue was discovered from any server side zaps. |
I prefer taking out item "Name" from structure for now and add comments & file a followup issue. |
Filed #6805 to change the type back to CHAR_STRING when we can. |
Problem
#6690 has a commit entitled "Fix type conversion error" which "fixes" the error by adding a
reinterpret_cast
fromuint8_t**
toByteSpan*
.If we assume
write
is true, we are now going to read the the data pointer and size from the Span so we can do the memcpy. The data pointer we will read is theuint8_t*
value. The size we will read is ... looks like some combination of the FabricConnected, OffPremiseServicesReachableIPv4, OffPremiseServicesReachableIPv6, and the random padding byte. This is unlikely to end well.If
write
is false, we will read whatever ByteSpan value was passed in and try to write it to the struct. We'll write its data pointer to theuint8_t*
, write the size to the booleans and padding byte, then later try to treat theuint8_t*
as a Pascal string and bad things will happen.Proposed Solution
Depending on how close we are to supporting CHAR_STRING in structs (@vivien-apple ?), one of:
And stop adding
reinterpret_cast
s just to get things to compile....@yufengwangca @andy31415 @woody-apple
The text was updated successfully, but these errors were encountered: