aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorva-kuznecov <va-kuznecov@ydb.tech>2023-02-14 09:06:50 +0300
committerva-kuznecov <va-kuznecov@ydb.tech>2023-02-14 09:06:50 +0300
commit702f8ef33042037a20ed38635b3c555cbefa7893 (patch)
tree757afe163c48679edac254be58d67af6b8e2e275
parent0a57f2296f811e91347ef317aaa555a32a4693f1 (diff)
downloadydb-702f8ef33042037a20ed38635b3c555cbefa7893.tar.gz
Fix UB in datashard (reference to nullptr)
-rw-r--r--ydb/core/tx/datashard/datashard_kqp_lookup_table.cpp6
-rw-r--r--ydb/core/tx/datashard/datashard_kqp_read_table.cpp6
-rw-r--r--ydb/library/yql/minikql/computation/mkql_computation_node.cpp2
-rw-r--r--ydb/library/yql/minikql/computation/mkql_computation_node.h2
4 files changed, 8 insertions, 8 deletions
diff --git a/ydb/core/tx/datashard/datashard_kqp_lookup_table.cpp b/ydb/core/tx/datashard/datashard_kqp_lookup_table.cpp
index c0b804b8f80..33be7932242 100644
--- a/ydb/core/tx/datashard/datashard_kqp_lookup_table.cpp
+++ b/ydb/core/tx/datashard/datashard_kqp_lookup_table.cpp
@@ -121,7 +121,7 @@ public:
switch (keysValues.Fetch(key)) {
case NUdf::EFetchStatus::Ok: {
TVector<TCell> keyCells(ParseResult.KeyIndices.size());
- FillKeyTupleValue(key, ParseResult.KeyIndices, ParseResult.KeyTypes, keyCells, ctx.TypeEnv);
+ FillKeyTupleValue(key, ParseResult.KeyIndices, ParseResult.KeyTypes, keyCells, *ctx.TypeEnv);
NUdf::TUnboxedValue result;
TKqpTableStats stats;
@@ -203,10 +203,10 @@ public:
MKQL_ENSURE_S(tableInfo);
TVector<TCell> fromCells(tableInfo->KeyColumns.size());
- FillKeyTupleValue(key, ParseResult.KeyIndices, ParseResult.KeyTypes, fromCells, ctx.TypeEnv);
+ FillKeyTupleValue(key, ParseResult.KeyIndices, ParseResult.KeyTypes, fromCells, *ctx.TypeEnv);
TVector<TCell> toCells(ParseResult.KeyIndices.size());
- FillKeyTupleValue(key, ParseResult.KeyIndices, ParseResult.KeyTypes, toCells, ctx.TypeEnv);
+ FillKeyTupleValue(key, ParseResult.KeyIndices, ParseResult.KeyTypes, toCells, *ctx.TypeEnv);
auto range = TTableRange(fromCells, true, toCells, true);
diff --git a/ydb/core/tx/datashard/datashard_kqp_read_table.cpp b/ydb/core/tx/datashard/datashard_kqp_read_table.cpp
index 08b10e07910..fb687b8c5b6 100644
--- a/ydb/core/tx/datashard/datashard_kqp_read_table.cpp
+++ b/ydb/core/tx/datashard/datashard_kqp_read_table.cpp
@@ -269,10 +269,10 @@ private:
EFetchResult ReadValue(TComputationContext& ctx, NUdf::TUnboxedValue* const* output) const final {
if (!this->Iterator) {
TVector<TCell> fromCells;
- BuildKeyTupleCells(ParseResult.FromTuple->GetType(), FromNode->GetValue(ctx), fromCells, ctx.TypeEnv);
+ BuildKeyTupleCells(ParseResult.FromTuple->GetType(), FromNode->GetValue(ctx), fromCells, *ctx.TypeEnv);
TVector<TCell> toCells;
- BuildKeyTupleCells(ParseResult.ToTuple->GetType(), ToNode->GetValue(ctx), toCells, ctx.TypeEnv);
+ BuildKeyTupleCells(ParseResult.ToTuple->GetType(), ToNode->GetValue(ctx), toCells, *ctx.TypeEnv);
auto range = TTableRange(fromCells, ParseResult.FromInclusive, toCells, ParseResult.ToInclusive);
@@ -328,7 +328,7 @@ private:
if (!RangeId) {
const auto localTid = this->ComputeCtx.GetLocalTableId(ParseResult.TableId);
const auto* tableInfo = this->ComputeCtx.Database->GetScheme().GetTableInfo(localTid);
- Ranges = CreateTableRanges<IsReverse>(ParseResult, RangesNode, ctx.TypeEnv, ctx, tableInfo->KeyColumns.size());
+ Ranges = CreateTableRanges<IsReverse>(ParseResult, RangesNode, *ctx.TypeEnv, ctx, tableInfo->KeyColumns.size());
RangeId = 0;
if (ItemsLimit) {
diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node.cpp
index f7249bea95c..6921e83fedd 100644
--- a/ydb/library/yql/minikql/computation/mkql_computation_node.cpp
+++ b/ydb/library/yql/minikql/computation/mkql_computation_node.cpp
@@ -36,7 +36,7 @@ TComputationContext::TComputationContext(const THolderFactory& holderFactory,
, TimeProvider(opts.TimeProvider)
, ArrowMemoryPool(arrowMemoryPool)
, WideFields(mutables.CurWideFieldsIndex, nullptr)
- , TypeEnv(*opts.TypeEnv)
+ , TypeEnv(opts.TypeEnv)
{
std::fill_n(MutableValues.get(), mutables.CurValueIndex, NUdf::TUnboxedValue(NUdf::TUnboxedValuePod::Invalid()));
diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node.h b/ydb/library/yql/minikql/computation/mkql_computation_node.h
index f113752a12d..640ef0f5813 100644
--- a/ydb/library/yql/minikql/computation/mkql_computation_node.h
+++ b/ydb/library/yql/minikql/computation/mkql_computation_node.h
@@ -119,7 +119,7 @@ struct TComputationContext : public TComputationContextLLVM {
bool ExecuteLLVM = true;
arrow::MemoryPool& ArrowMemoryPool;
std::vector<NUdf::TUnboxedValue*> WideFields;
- TTypeEnvironment& TypeEnv;
+ TTypeEnvironment* TypeEnv = nullptr;
TComputationContext(const THolderFactory& holderFactory,
const NUdf::IValueBuilder* builder,