Skip to content

Commit b767534

Browse files
htuchfredlas
authored andcommitted
config_validation: fix heap-use-after-free. (envoyproxy#5847)
Same issue as in envoyproxy#4940, but on the config_validation side. Risk level: Low Testing: corpus entry added. Signed-off-by: Harvey Tuch <[email protected]> Signed-off-by: Fred Douglas <[email protected]>
1 parent b4437ee commit b767534

File tree

3 files changed

+400
-1
lines changed

3 files changed

+400
-1
lines changed

source/server/config_validation/server.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,10 @@ class ValidationInstance : Logger::Loggable<Logger::Id::main>,
154154
AccessLog::AccessLogManagerImpl access_log_manager_;
155155
std::unique_ptr<Upstream::ValidationClusterManagerFactory> cluster_manager_factory_;
156156
InitManagerImpl init_manager_;
157-
std::unique_ptr<ListenerManagerImpl> listener_manager_;
157+
// secret_manager_ must come before listener_manager_, since there may be active filter chains
158+
// referencing it, so need to destruct these first.
158159
std::unique_ptr<Secret::SecretManager> secret_manager_;
160+
std::unique_ptr<ListenerManagerImpl> listener_manager_;
159161
std::unique_ptr<OverloadManager> overload_manager_;
160162
MutexTracer* mutex_tracer_;
161163
Http::ContextImpl http_context_;

source/server/server.h

+2
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ class InstanceImpl : Logger::Loggable<Logger::Id::main>, public Instance {
210210
Assert::ActionRegistrationPtr assert_action_registration_;
211211
ThreadLocal::Instance& thread_local_;
212212
Api::ApiPtr api_;
213+
// secret_manager_ must come before dispatcher_, since there may be active connections
214+
// referencing it, so need to destruct these first.
213215
std::unique_ptr<Secret::SecretManager> secret_manager_;
214216
Event::DispatcherPtr dispatcher_;
215217
std::unique_ptr<AdminImpl> admin_;

0 commit comments

Comments
 (0)