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] Android matter sdk setFabricId does not accept values which touch twos compliment #28696

Closed
maurycyw opened this issue Aug 14, 2023 · 2 comments · Fixed by #28724
Closed
Assignees
Labels
android bug Something isn't working

Comments

@maurycyw
Copy link

maurycyw commented Aug 14, 2023

Reproduction steps

Using an example fabric id: d5f9b903418fda11, I am unable to set the fabric id on the controller params since it only accepts a "signed" Long as a parameter. This fabric id can be parsed as an unsigned Long but when converting to a Long it becomes a negative value and fails the sdk check:

public Builder setFabricId(long fabricId) {
        if (fabricId < 1L) {
            throw new IllegalArgumentException("fabricId must be > 0");
        } else {
            this.fabricId = fabricId;
            return this;
        }
}

Repro steps:

  1. Try to set a valid fabric id with a value greater than 7FFF_FFFF_FFFF_FFFF on the controller parameters.

Bug prevalence

everytime

GitHub hash of the SDK that was being used

8f66f42

Platform

android

Platform Version(s)

No response

Anything else?

No response

@maurycyw maurycyw added bug Something isn't working needs triage labels Aug 14, 2023
@maurycyw maurycyw changed the title [BUG] Android matter sdk setFabricId only accepts a Long. [BUG] Android matter sdk setFabricId does not accept values which touch twos compliment Aug 15, 2023
@yunhanw-google
Copy link
Contributor

yunhanw-google commented Aug 17, 2023

I think we should consider to use BigInteger
I think this issue happens in several place with uint64_t in android controller.
both EventNumber and FabricId needs to be fixed since they are defined with
uint64_t EventNumber;
uint64_t FabricId;

@yunhanw-google
Copy link
Contributor

yunhanw-google commented Aug 17, 2023

@joonhaengHeo do you have time to fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants