This repository has been archived by the owner on Jun 23, 2022. It is now read-only.
fix(asan): heap-buffer-overflow in meta_test_base.h #377
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.
Related issue
#376
Reason
The 3th argument of
utils::factory_store<server_load_balancer>::create(const char *name, ::dsn::provider_type type, T1 t1)
is set tometa_test_base
type in line 24 ofmeta_test_base.h
.rdsn/src/dist/replication/test/meta_test/unit_test/meta_test_base.h
Lines 21 to 29 in 7b37038
Therefore, It will be illegally cast to
meta_service
type in line 60 ofserver_load_balancer.h
and reportheap-buffer-overflow
in line 235.rdsn/src/dist/replication/meta_server/server_load_balancer.h
Lines 54 to 61 in 7b37038
rdsn/src/dist/replication/meta_server/server_load_balancer.h
Lines 230 to 240 in 7b37038
The root cause is that
meta_test_base
object don’t malloc matching address withmeta_service
type, and then, it will be reportheap-buffer-overflow
when visiting themeta_service
class member via Illegal address.Solution
The 3th argument of
utils::factory_store<server_load_balancer>::create(const char *name, ::dsn::provider_type type, T1 t1)
is set tometa_service
type: