songgaoye opened a new pull request, #3692:
URL: https://github.com/apache/brpc/pull/3692

   ### What problem does this PR solve?
   
   Issue Number: resolve
   
   Problem Summary:
   
   `DynPartLoadBalancer::SelectServer()` stores selectable backends in a fixed
   eight-entry stack array. When more than eight sockets are available, it 
passes
   `&ptrs[8].first` to `Socket::Address()` before checking the candidate bound.
   The subsequent assertion is therefore too late and the ninth candidate writes
   past the array boundary.
   
   ### What is changed and the side effects?
   
   Changed:
   
   - Keep the stack-backed candidate storage for up to eight servers.
   - Allocate candidate storage sized to the server snapshot when it contains 
more
     than eight servers.
   - Remove the late fixed-size assertion.
   - Add coverage that selects from nine valid `SelectiveChannel` fake sockets.
   
   Side effects:
   
   - Performance effects:
   
     The existing stack-only path is retained for snapshots with at most eight
     servers. Larger snapshots allocate candidate storage during selection.
   
   - Breaking backward compatibility:
   
     None. Configurations with more than eight selectable dynamic partition
     channels now work correctly instead of overrunning stack storage.
   
   ---
   
   ### Check List:
   
   - Please make sure your changes are compilable.
   - When providing us with a new feature, it is best to add related tests.
   - Please follow [Contributor Covenant Code of 
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to