router/scoped_rds: guard on-demand update for inline-config scopes#44071
Open
whutwhu wants to merge 2 commits intoenvoyproxy:mainfrom
Open
router/scoped_rds: guard on-demand update for inline-config scopes#44071whutwhu wants to merge 2 commits intoenvoyproxy:mainfrom
whutwhu wants to merge 2 commits intoenvoyproxy:mainfrom
Conversation
f9407ed to
576e9a9
Compare
…date Signed-off-by: Xin Li <lixinusa2013@gmail.com> This PR fix a crash for srds when a scoped route uses inline route_configuration instead of route_configuration_name. Additional Description: When a scoped route uses inline route_configuration instead of route_configuration_name, the scope is added to scope_name_by_hash_ but not to route_provider_by_scope_ (no RDS provider is needed). If the on-demand route update path (onDemandRdsUpdate) is triggered for such a scope, route_provider_by_scope_[scope_name] inserts a null unique_ptr via operator[] and then dereferences it, causing a crash. Use find() instead of operator[] to look up the scope in route_provider_by_scope_. If the scope has no RDS provider (inline config), return false to the callback instead of crashing. Risk Level: Low Testing: Unit test added Docs Changes: N/A Release Notes: N/A
576e9a9 to
5d224c3
Compare
Signed-off-by: Xin Li <lixinusa2013@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Message:
This PR fixes an SRDS crash when a scoped route uses inline route_configuration instead of route_configuration_name.
Additional Description:
When a scoped route uses inline
route_configurationinstead ofroute_configuration_name, the scope is added toscope_name_by_hash_but not toroute_provider_by_scope_(no RDS provider is needed). If the on-demand route update path (onDemandRdsUpdate) is triggered for such a scope,route_provider_by_scope_[scope_name]inserts a null unique_ptr via operator[] and then dereferences it, causing a crash.Use
find()instead ofoperator[]to look up the scope inroute_provider_by_scope_. If the scope has no RDS provider (inline config), return false to the callback instead of crashing.Risk Level:
Low
Testing:
It includes a unit test that reproduces the crash and verifies the fix.
Signed-off-by: Xin Li lixinusa2013@gmail.com