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

grpc-js: Fix address equality check in pick-first #2380

Merged

Conversation

murgatroid99
Copy link
Member

This fixes #2379. In the current code, if the pick-first LB policy gets an address list that is shorter than the previous address list, the loop checking for equality can run off the edge of the list and pass an undefined value the type checker doesn't account for into subchannelAddressEqual. I added three layers of protection to avoid this:

  1. The loop is skipped if the lengths are equal.
  2. subchannelAddressEqual is only called if the value is not undefined.
  3. subchannelAddressEqual can now handle undefined values, in case something like this happens elsewhere.

@murgatroid99 murgatroid99 merged commit 7aba000 into grpc:@grpc/grpc-js@1.8.x Mar 7, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants