Skip to content

Commit afbc266

Browse files
validate dangerouse construction (#11873)
1 parent 71a7067 commit afbc266

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ydb/core/tx/columnshard/engines/scheme/indexes/abstract/program.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,12 @@ class TNormalForm {
443443

444444
std::shared_ptr<TDataForIndexesCheckers> TDataForIndexesCheckers::Build(const TProgramContainer& program) {
445445
AFL_DEBUG(NKikimrServices::TX_COLUMNSHARD)("program", program.DebugString());
446-
auto fStep = program.GetSteps().front();
446+
auto& steps = program.GetStepsVerified();
447+
if (!steps.size()) {
448+
AFL_WARN(NKikimrServices::TX_COLUMNSHARD)("event", "no_steps_in_program");
449+
return nullptr;
450+
}
451+
auto fStep = steps.front();
447452
TNormalForm nForm;
448453
for (auto&& s : fStep->GetAssignes()) {
449454
if (!nForm.Add(s, program)) {

ydb/core/tx/program/program.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ class TProgramContainer {
8585
}
8686
}
8787

88+
const std::vector<std::shared_ptr<NSsa::TProgramStep>>& GetStepsVerified() const {
89+
AFL_VERIFY(!!Program);
90+
return Program->Steps;
91+
}
92+
8893
template <class TDataContainer>
8994
inline arrow::Status ApplyProgram(std::shared_ptr<TDataContainer>& batch) const {
9095
if (Program) {

0 commit comments

Comments
 (0)