-
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
Use of Variable Length Arrays in generated code #8558
Comments
cc @tcarmelveilleux for visibility |
The root cause of this issue is wanted to pass "flat arrays" to callbacks when lists are used. I think these lists should be handled by iteration over the payload with an abstracted list iterator backed by a TLV reader, rather than copy to flat arrays. That would avoid alloc entirely, and avoid requiring to trust any sizes from the wire for an alloc. A temporary reader could be used to schema-validate, but access to the list elements should be abstracted with an iterator. |
+1 for iterator access. |
Fixed in #10681 |
Problem
variable length arrays are used in generated code: CHIPClientCallbacks.cpp. For example: https://github.com/project-chip/connectedhomeip/blob/master/src/controller/data_model/gen/CHIPClientCallbacks.cpp#L854
uint16_t count = chip::Encoding::LittleEndian::Read16(message);
_AudioOutputInfo
data[count];
There are about 24 such instances. There are 2 issues with this usage:
As explained in the problem section.
Compile code on top of tree and inspect generated CHIPClientCallbacks.cpp file.
The text was updated successfully, but these errors were encountered: