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

Guid handling does not account for endianness #240

Closed
JoshLove-msft opened this issue Jan 31, 2023 · 2 comments
Closed

Guid handling does not account for endianness #240

JoshLove-msft opened this issue Jan 31, 2023 · 2 comments

Comments

@JoshLove-msft
Copy link
Member

          > Which would confirm your hunch @KrzysztofCwalina because that encodes big endian and reads big endian in the read methods. So we would always hit the ToArray case 😭

My understanding is that TryRead should only be used for little endian, not that it would return false on big endian. This means that the current code could end up reversing the lock token if the client machine is actually big endian. Using the Guid constructor handles both cases at the cost of us needing to allocate always. We can do an endian check ourselves to only use TryRead for little endian to avoid the extra allocation.

Re: the AMQP lib handling that could cause issues now that we no longer have full control over the machine where the ReceivedMessage is serialized. Since we are serializing the received message as part of this PR, we should probably file an issue so that the AMQP lib has handling for endianness.

Originally posted by @JoshLove-msft in Azure/azure-sdk-for-net#33682 (comment)

@JoshLove-msft
Copy link
Member Author

public static unsafe void WriteUuid(ByteBuffer buffer, Guid data)
should not assume the endianness of the machine.

@xinchen10
Copy link
Member

Fixed in 2.6.2

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

No branches or pull requests

2 participants