Skip to content

Commit e6474a4

Browse files
authored
Fixed heap-use-after-free (#26454) (#26502)
2 parents cac9004 + d552e0a commit e6474a4

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

ydb/core/tx/replication/ydb_proxy/local_proxy/local_proxy.cpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,16 @@ void TLocalProxyActor::Handle(TEvYdbProxy::TEvAlterTopicRequest::TPtr& ev) {
4545
*consumer = c;
4646
}
4747

48-
auto callback = [replyTo = ev->Sender, cookie = ev->Cookie, path = path, this](Ydb::StatusIds::StatusCode statusCode, const google::protobuf::Message*) {
48+
auto callback = [
49+
actorSystem = TActivationContext::ActorSystem(),
50+
replyTo = ev->Sender,
51+
cookie = ev->Cookie,
52+
path = path
53+
](Ydb::StatusIds::StatusCode statusCode, const google::protobuf::Message*) {
4954
NYdb::NIssue::TIssues issues;
5055
NYdb::TStatus status(static_cast<NYdb::EStatus>(statusCode), std::move(issues));
51-
Send(replyTo, new TEvYdbProxy::TEvAlterTopicResponse(std::move(status)), 0, cookie);
56+
57+
actorSystem->Send(replyTo, new TEvYdbProxy::TEvAlterTopicResponse(std::move(status)), 0, cookie);
5258
};
5359

5460
NGRpcService::DoAlterTopicRequest(std::make_unique<TLocalProxyRequest>(path, Database, std::move(request), callback), *this);
@@ -65,7 +71,12 @@ void TLocalProxyActor::Handle(TEvYdbProxy::TEvDescribeTopicRequest::TPtr& ev) {
6571
auto request = std::make_unique<Ydb::Topic::DescribeTopicRequest>();
6672
request.get()->set_path(TStringBuilder() << "/" << Database << path);
6773

68-
auto callback = [replyTo = ev->Sender, cookie = ev->Cookie, path = path, this](Ydb::StatusIds::StatusCode statusCode, const google::protobuf::Message* result) {
74+
auto callback = [
75+
actorSystem = TActivationContext::ActorSystem(),
76+
replyTo = ev->Sender,
77+
cookie = ev->Cookie,
78+
path = path
79+
](Ydb::StatusIds::StatusCode statusCode, const google::protobuf::Message* result) {
6980
NYdb::NIssue::TIssues issues;
7081
Ydb::Topic::DescribeTopicResult describe;
7182
if (statusCode == Ydb::StatusIds::StatusCode::StatusIds_StatusCode_SUCCESS) {
@@ -80,7 +91,8 @@ void TLocalProxyActor::Handle(TEvYdbProxy::TEvDescribeTopicRequest::TPtr& ev) {
8091

8192
NYdb::TStatus status(static_cast<NYdb::EStatus>(statusCode), std::move(issues));
8293
NYdb::NTopic::TDescribeTopicResult r(std::move(status), std::move(describe));
83-
Send(replyTo, new TEvYdbProxy::TEvDescribeTopicResponse(r), 0, cookie);
94+
95+
actorSystem->Send(replyTo, new TEvYdbProxy::TEvDescribeTopicResponse(r), 0, cookie);
8496
};
8597

8698
NGRpcService::DoDescribeTopicRequest(std::make_unique<TLocalProxyRequest>(path, Database, std::move(request), callback), *this);
@@ -97,7 +109,12 @@ void TLocalProxyActor::Handle(TEvYdbProxy::TEvDescribePathRequest::TPtr& ev) {
97109
auto request = std::make_unique<Ydb::Scheme::DescribePathRequest>();
98110
request.get()->set_path(TStringBuilder() << "/" << Database << path);
99111

100-
auto callback = [replyTo = ev->Sender, cookie = ev->Cookie, path = path, this](Ydb::StatusIds::StatusCode statusCode, const google::protobuf::Message* result) {
112+
auto callback = [
113+
actorSystem = TActivationContext::ActorSystem(),
114+
replyTo = ev->Sender,
115+
cookie = ev->Cookie,
116+
path = path
117+
](Ydb::StatusIds::StatusCode statusCode, const google::protobuf::Message* result) {
101118
NYdb::NIssue::TIssues issues;
102119
NYdb::NScheme::TSchemeEntry entry;
103120
if (statusCode == Ydb::StatusIds::StatusCode::StatusIds_StatusCode_SUCCESS) {
@@ -112,7 +129,8 @@ void TLocalProxyActor::Handle(TEvYdbProxy::TEvDescribePathRequest::TPtr& ev) {
112129

113130
NYdb::TStatus status(static_cast<NYdb::EStatus>(statusCode), std::move(issues));
114131
NYdb::NScheme::TDescribePathResult r(std::move(status), std::move(entry));
115-
Send(replyTo, new TEvYdbProxy::TEvDescribePathResponse(r), 0, cookie);
132+
133+
actorSystem->Send(replyTo, new TEvYdbProxy::TEvDescribePathResponse(r), 0, cookie);
116134
};
117135

118136
NGRpcService::DoDescribePathRequest(std::make_unique<TLocalProxyRequest>(path, Database, std::move(request), callback), *this);

ydb/core/tx/replication/ydb_proxy/local_proxy/local_proxy.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class TLocalProxyActor
3131

3232
STATEFN(StateWork);
3333

34-
3534
private:
3635
const TString Database;
3736
TString LogPrefix;

0 commit comments

Comments
 (0)