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

GH-26: Fix infinite loop on invalid next configuration parameter. #27

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nkljajic
Copy link
Collaborator

When 'Parameter Number' and 'Next Parameter Number' are equal, configuration parameter discovery can not complete.
For example, this RX Z-Wave frame will set Node Interview into an infinite loop:

70 : COMMAND_CLASS_CONFIGURATION
0F : CONFIGURATION_PROPERTIES_REPORT_V4
00 : Parameter Number 1 (MSB)
71 : Parameter Number 2 (LSB)
09 : Format 0x01 Unsigned Integer, size 0x1
01 : Min Value
64 : Max Value
0A : Default Value
00 : Next Parameter Number (MSB)
71 : Next Parameter Number (LSB)
02 : No Bulk support 0x1, Not Advanced Parameter 0x0

Change

Detect case when next and current parameter numbers match and exit discovery loop.

Checklist

…ameter.

When 'Parameter Number' and 'Next Parameter Number' are equal,
configuration parameter discovery can not complete.
For example, this Z-Wave frame will set Node Interview into an infinite loop:

70 : COMMAND_CLASS_CONFIGURATION
0F : CONFIGURATION_PROPERTIES_REPORT_V4
00 : Parameter Number 1 (MSB)
71 : Parameter Number 2 (LSB)
09 : Format 0x01 Unsigned Integer, size 0x1
01 : Min Value
64 : Max Value
0A : Default Value
00 : Next Parameter Number (MSB)
71 : Next Parameter Number (LSB)
02 : No Bulk support 0x1, Not Advanced Parameter 0x0

Signed-off-by: Nenad Kljajic <nkljajic@control4.com>
@nkljajic nkljajic marked this pull request as draft February 13, 2024 10:13
@rzr
Copy link
Collaborator

rzr commented Feb 14, 2024

ok this change looks good, I'll give a try, meanwhile a unit test covering this would be welcome

@rzr
Copy link
Collaborator

rzr commented Feb 15, 2024

Great !

I see this building on your side:
https://github.com/nkljajic/UnifySDK/actions/runs/7884855902/job/21514745357

We can give a try on our codebase

cc: @silabs-borisl

silabs-borisl added a commit to silabs-borisl/UnifySDK that referenced this pull request Feb 16, 2024
ZPC implementation only

Forwarded: SiliconLabs#27
Bug-SiliconLabs: UIC-3066
Bug-Github: SiliconLabs#27
silabs-borisl added a commit to silabs-borisl/UnifySDK that referenced this pull request Feb 16, 2024
ZPC implementation only
Forwarded: SiliconLabs#27
Bug-SiliconLabs: UIC-3068
Bug-Github: SiliconLabs#27
silabs-borisl added a commit to silabs-borisl/UnifySDK that referenced this pull request Feb 16, 2024
ZPC implementation only
Forwarded: SiliconLabs#27
Bug-SiliconLabs: UIC-3067
Bug-Github: SiliconLabs#27
silabs-borisl added a commit to silabs-borisl/UnifySDK that referenced this pull request Feb 16, 2024
Forwarded: SiliconLabs#27
Bug-SiliconLabs: UIC-3042
Bug-Github: SiliconLabs#27
@@ -723,6 +723,16 @@ static sl_status_t
if (frame_length >= (current_index + 2)) {
next_id = (configuration_parameter_id_t)((frame[current_index] << 8)
| frame[current_index + 1]);
if (next_id == parameter_id) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't there be the same issue if a device report a next parameter number lower than the current?

Suggested change
if (next_id == parameter_id) {
if (next_id <= parameter_id) {

And of course also adjust the log message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants