Skip to content

router/scoped_rds: guard on-demand update for inline-config scopes#44071

Open
whutwhu wants to merge 2 commits intoenvoyproxy:mainfrom
whutwhu:fix-srds-inline-scope-on-demand-crash
Open

router/scoped_rds: guard on-demand update for inline-config scopes#44071
whutwhu wants to merge 2 commits intoenvoyproxy:mainfrom
whutwhu:fix-srds-inline-scope-on-demand-crash

Conversation

@whutwhu
Copy link
Contributor

@whutwhu whutwhu commented Mar 22, 2026

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_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:
It includes a unit test that reproduces the crash and verifies the fix.

Signed-off-by: Xin Li lixinusa2013@gmail.com

@whutwhu whutwhu force-pushed the fix-srds-inline-scope-on-demand-crash branch from f9407ed to 576e9a9 Compare March 22, 2026 07:33
…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
@whutwhu whutwhu force-pushed the fix-srds-inline-scope-on-demand-crash branch from 576e9a9 to 5d224c3 Compare March 22, 2026 08:00
Signed-off-by: Xin Li <lixinusa2013@gmail.com>
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.

1 participant