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

EmberAfAttributeMetadata size field is always 0 for external attributes #19647

Closed
mrjerryjohns opened this issue Jun 15, 2022 · 2 comments · Fixed by #19812
Closed

EmberAfAttributeMetadata size field is always 0 for external attributes #19647

mrjerryjohns opened this issue Jun 15, 2022 · 2 comments · Fixed by #19812
Assignees

Comments

@mrjerryjohns
Copy link
Contributor

Problem

When implementing emberAfExternalAttributeReadCallback, the maxReadLength field is always 0. This is not the case for non-external attributes.

This makes it difficult for applications to really know how much space is available, especially for variable-length types like octet-strings and char strings.

This is caused by use of that field as an offset as well into the store, where the offsets are summed up in the attribute metadata table. This has to be 0 in that situation since no space is actually allocated.

@bzbarsky-apple
Copy link
Contributor

So I just checked, and in emAfReadOrWriteAttribute when computing the offsets we have:

                            if (!(am->mask & ATTRIBUTE_MASK_EXTERNAL_STORAGE) && !(am->mask & ATTRIBUTE_MASK_SINGLETON))
                            {
                                attributeOffsetIndex = static_cast<uint16_t>(attributeOffsetIndex + emberAfAttributeSize(am));
                            }

so we could have nonzero sizes here and not mess up the indexing.

What we would need to make sure of is that the cluster/endpoint sizes are not affected. Let me see what I can do here...

@bzbarsky-apple
Copy link
Contributor

@mrjerryjohns I think project-chip/zap#558 should do what we want here.

bzbarsky-apple added a commit to bzbarsky-apple/connectedhomeip that referenced this issue Jun 21, 2022
Fixes type sizes for external attributes for which a size is known.

Fixes project-chip#19647

The darwin-framework-tool change for bitmaps was needed because
presumably something changed on the ZAP side in terms of weak bitmaps
suddenly testing true for if_is_bitmap, which I thought they had
already been doing...
bzbarsky-apple added a commit to bzbarsky-apple/connectedhomeip that referenced this issue Jun 22, 2022
Fixes type sizes for external attributes for which a size is known.

Fixes project-chip#19647

The darwin-framework-tool change for bitmaps was needed because
presumably something changed on the ZAP side in terms of weak bitmaps
suddenly testing true for if_is_bitmap, which I thought they had
already been doing...
andy31415 pushed a commit that referenced this issue Jun 22, 2022
* Update ZAP.

Fixes type sizes for external attributes for which a size is known.

Fixes #19647

The darwin-framework-tool change for bitmaps was needed because
presumably something changed on the ZAP side in terms of weak bitmaps
suddenly testing true for if_is_bitmap, which I thought they had
already been doing...

* Ignore the size of external attributes when computing offsets into the singleton store.

External attributes are not actually stored in the singleton store.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants