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

[BUG] emberAfClearDynamicEndpoint() invalid real index cast (uint8_t instead of uint16_t) #36007

Closed
hacker-cb opened this issue Oct 10, 2024 · 2 comments · Fixed by #36047
Closed
Labels
bug Something isn't working needs triage

Comments

@hacker-cb
Copy link

hacker-cb commented Oct 10, 2024

Reproduction steps

Current emberAfClearDynamicEndpoint() has error during calculation real index of dynamic endpoint. As a result, total endpoints index is limited to 255.

emberAfSetDynamicEndpoint() - ok, uint16_t.

index = static_cast<uint16_t>(realIndex);

emberAfClearDynamicEndpoint() - wrong, uint8_t.

index = static_cast<uint8_t>(index + FIXED_ENDPOINT_COUNT);

So, in emberAfClearDynamicEndpoint() should be cast to uint16_t

Updates:

emberAfGetDynamicIndexFromEndpoint - wrong, uint8_t.

return static_cast<uint8_t>(index - FIXED_ENDPOINT_COUNT);

Bug prevalence

Always

GitHub hash of the SDK that was being used

8a01f93

Platform

core

@hacker-cb hacker-cb added bug Something isn't working needs triage labels Oct 10, 2024
@bzbarsky-apple
Copy link
Contributor

emberAfGetDynamicIndexFromEndpoint has a similar problem.

@hacker-cb
Copy link
Author

hacker-cb commented Oct 11, 2024

I updated issue first message.

bzbarsky-apple added a commit to bzbarsky-apple/connectedhomeip that referenced this issue Oct 11, 2024
Not everything got updated correctly when endpoint indices changed from uint8 to
uint16.

Fixes project-chip#36007
@mergify mergify bot closed this as completed in #36047 Oct 11, 2024
@mergify mergify bot closed this as completed in 48cf3e5 Oct 11, 2024
yyzhong-g pushed a commit to yyzhong-g/connectedhomeip that referenced this issue Dec 12, 2024
Not everything got updated correctly when endpoint indices changed from uint8 to
uint16.

Fixes project-chip#36007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants