This is an automated email from the ASF dual-hosted git repository.
yangzhg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 6523b546ab [chore](vulnerability) fix some high risk vulnerabilities
report by bug scanner (#15621)
6523b546ab is described below
commit 6523b546ab77948c3356a1aeae71c82e5f253f2c
Author: Zhengguo Yang <[email protected]>
AuthorDate: Thu Jan 5 14:58:23 2023 +0800
[chore](vulnerability) fix some high risk vulnerabilities report by bug
scanner (#15621)
* [chore](vulnerability) fix some high risk vulnerabilities report by bug
scanner
---
be/src/exprs/aggregate_functions.cpp | 4 +++-
be/src/olap/merger.cpp | 2 +-
be/src/olap/storage_policy_mgr.cpp | 9 ++++++---
be/src/olap/utils.cpp | 10 ++++++++--
.../exec/streaming_aggregation_sink_operator.cpp | 6 ++++--
be/src/pipeline/pipeline_fragment_context.cpp | 5 +++--
be/src/runtime/plan_fragment_executor.cpp | 4 +++-
be/src/vec/exec/vmysql_scan_node.cpp | 21 ++++++++++++---------
be/src/vec/exec/vrepeat_node.cpp | 6 +++---
be/src/vec/exec/vschema_scan_node.cpp | 16 ++++++++++------
.../functions/functions_multi_string_position.cpp | 12 ++++++++----
11 files changed, 61 insertions(+), 34 deletions(-)
diff --git a/be/src/exprs/aggregate_functions.cpp
b/be/src/exprs/aggregate_functions.cpp
index 4a3f9cd090..202dd1852b 100644
--- a/be/src/exprs/aggregate_functions.cpp
+++ b/be/src/exprs/aggregate_functions.cpp
@@ -824,7 +824,9 @@ void
AggregateFunctions::string_concat_update(FunctionContext* ctx, const String
const auto header_len = sizeof(StringConcatHeader);
DCHECK(header_len == sizeof(sep->len));
*result = StringVal(ctx->allocate(header_len), header_len);
- *reinterpret_cast<StringConcatHeader*>(result->ptr) = sep->len;
+ if (result->ptr) {
+ *reinterpret_cast<StringConcatHeader*>(result->ptr) = sep->len;
+ }
}
result->append(ctx, sep->ptr, sep->len, src.ptr, src.len);
}
diff --git a/be/src/olap/merger.cpp b/be/src/olap/merger.cpp
index e91949a11c..83fc250e85 100644
--- a/be/src/olap/merger.cpp
+++ b/be/src/olap/merger.cpp
@@ -197,7 +197,7 @@ Status Merger::vertical_compact_one_group(
reader_params.origin_return_columns = &reader_params.return_columns;
RETURN_NOT_OK(reader.init(reader_params));
- if (is_key && reader_params.record_rowids) {
+ if (reader_params.record_rowids) {
stats_output->rowid_conversion->set_dst_rowset_id(dst_rowset_writer->rowset_id());
// init segment rowid map for rowid conversion
std::vector<uint32_t> segment_num_rows;
diff --git a/be/src/olap/storage_policy_mgr.cpp
b/be/src/olap/storage_policy_mgr.cpp
index e330dc3229..ce9241c7f8 100644
--- a/be/src/olap/storage_policy_mgr.cpp
+++ b/be/src/olap/storage_policy_mgr.cpp
@@ -34,9 +34,12 @@ void StoragePolicyMgr::update(const std::string& name, const
StoragePolicyPtr& p
it->second = policy;
s3_fs = std::dynamic_pointer_cast<io::S3FileSystem>(
io::FileSystemMap::instance()->get(name));
- DCHECK(s3_fs);
- s3_fs->set_ak(policy->s3_ak);
- s3_fs->set_sk(policy->s3_sk);
+ if (s3_fs) {
+ s3_fs->set_ak(policy->s3_ak);
+ s3_fs->set_sk(policy->s3_sk);
+ } else {
+ DCHECK(false) << "s3_fs is null";
+ }
}
}
if (s3_fs) {
diff --git a/be/src/olap/utils.cpp b/be/src/olap/utils.cpp
index 86b231a64a..c85e1e5205 100644
--- a/be/src/olap/utils.cpp
+++ b/be/src/olap/utils.cpp
@@ -62,8 +62,14 @@ using namespace ErrorCode;
Status olap_compress(const char* src_buf, size_t src_len, char* dest_buf,
size_t dest_len,
size_t* written_len, OLAPCompressionType
compression_type) {
if (nullptr == src_buf || nullptr == dest_buf || nullptr == written_len) {
- LOG(WARNING) << "input param with nullptr pointer. [src_buf=" <<
src_buf
- << " dest_buf=" << dest_buf << " written_len=" <<
written_len << "]";
+ LOG(WARNING) << "input param with nullptr pointer. src_buf is nullptr:
"
+ << (src_buf == nullptr ? "true" : "false") << " src_buf=["
+ << (src_buf == nullptr ? "nullptr" : src_buf)
+ << "], dest_buf is nullptr: " << (dest_buf == nullptr ?
"true" : "false")
+ << " dest_buf=[" << (dest_buf == nullptr ? "nullptr" :
dest_buf)
+ << "], written_len is nullptr: "
+ << (written_len == nullptr ? "true" : " false") << "
written_len=["
+ << (dest_buf == nullptr ? -1 : *dest_buf) << "]";
return Status::Error<INVALID_ARGUMENT>();
}
diff --git a/be/src/pipeline/exec/streaming_aggregation_sink_operator.cpp
b/be/src/pipeline/exec/streaming_aggregation_sink_operator.cpp
index ae271ebb14..c896862702 100644
--- a/be/src/pipeline/exec/streaming_aggregation_sink_operator.cpp
+++ b/be/src/pipeline/exec/streaming_aggregation_sink_operator.cpp
@@ -64,8 +64,10 @@ Status StreamingAggSinkOperator::close(RuntimeState* state) {
// finish should be set, if not set here means error.
_data_queue->set_canceled();
}
- COUNTER_SET(_queue_size_counter, _data_queue->max_size_of_queue());
- COUNTER_SET(_queue_byte_size_counter, _data_queue->max_bytes_in_queue());
+ if (_data_queue) {
+ COUNTER_SET(_queue_size_counter, _data_queue->max_size_of_queue());
+ COUNTER_SET(_queue_byte_size_counter,
_data_queue->max_bytes_in_queue());
+ }
return StreamingOperator::close(state);
}
diff --git a/be/src/pipeline/pipeline_fragment_context.cpp
b/be/src/pipeline/pipeline_fragment_context.cpp
index 1430c8d6f6..4b5dcd27d3 100644
--- a/be/src/pipeline/pipeline_fragment_context.cpp
+++ b/be/src/pipeline/pipeline_fragment_context.cpp
@@ -270,8 +270,9 @@ Status PipelineFragmentContext::prepare(const
doris::TExecPlanFragmentParams& re
RETURN_IF_ERROR(_create_sink(request.fragment.output_sink));
}
RETURN_IF_ERROR(_build_pipeline_tasks(request));
-
- _runtime_state->runtime_profile()->add_child(_sink->profile(), true,
nullptr);
+ if (_sink) {
+ _runtime_state->runtime_profile()->add_child(_sink->profile(), true,
nullptr);
+ }
_runtime_state->runtime_profile()->add_child(_root_plan->runtime_profile(),
true, nullptr);
_runtime_state->runtime_profile()->add_child(_runtime_profile.get(), true,
nullptr);
diff --git a/be/src/runtime/plan_fragment_executor.cpp
b/be/src/runtime/plan_fragment_executor.cpp
index d7ae0556e7..56743807a9 100644
--- a/be/src/runtime/plan_fragment_executor.cpp
+++ b/be/src/runtime/plan_fragment_executor.cpp
@@ -94,7 +94,9 @@ Status PlanFragmentExecutor::prepare(const
TExecPlanFragmentParams& request,
fragments_ctx == nullptr ? request.query_globals :
fragments_ctx->query_globals;
_runtime_state.reset(new RuntimeState(params, request.query_options,
query_globals, _exec_env));
_runtime_state->set_query_fragments_ctx(fragments_ctx);
- _runtime_state->set_query_mem_tracker(fragments_ctx->query_mem_tracker);
+ _runtime_state->set_query_mem_tracker(fragments_ctx == nullptr
+ ?
_exec_env->orphan_mem_tracker()
+ :
fragments_ctx->query_mem_tracker);
_runtime_state->set_tracer(std::move(tracer));
SCOPED_ATTACH_TASK(_runtime_state.get());
diff --git a/be/src/vec/exec/vmysql_scan_node.cpp
b/be/src/vec/exec/vmysql_scan_node.cpp
index 3a343147a3..e0f520f6ae 100644
--- a/be/src/vec/exec/vmysql_scan_node.cpp
+++ b/be/src/vec/exec/vmysql_scan_node.cpp
@@ -98,16 +98,15 @@ Status VMysqlScanNode::prepare(RuntimeState* state) {
}
Status VMysqlScanNode::open(RuntimeState* state) {
+ if (nullptr == state) {
+ return Status::InternalError("input pointer is nullptr.");
+ }
START_AND_SCOPE_SPAN(state->get_tracer(), span, "VMysqlScanNode::open");
SCOPED_TIMER(_runtime_profile->total_time_counter());
RETURN_IF_ERROR(ExecNode::open(state));
SCOPED_CONSUME_MEM_TRACKER(mem_tracker_growh());
VLOG_CRITICAL << "MysqlScanNode::Open";
- if (nullptr == state) {
- return Status::InternalError("input pointer is nullptr.");
- }
-
if (!_is_init) {
return Status::InternalError("used before initialize.");
}
@@ -146,11 +145,15 @@ Status VMysqlScanNode::write_text_slot(char* value, int
value_length, SlotDescri
}
Status VMysqlScanNode::get_next(RuntimeState* state, vectorized::Block* block,
bool* eos) {
+ if (state == nullptr || block == nullptr || eos == nullptr) {
+ return Status::InternalError("input is nullptr");
+ }
INIT_AND_SCOPE_GET_NEXT_SPAN(state->get_tracer(), _get_next_span,
"VMysqlScanNode::get_next");
VLOG_CRITICAL << "VMysqlScanNode::GetNext";
- if (state == NULL || block == NULL || eos == NULL)
- return Status::InternalError("input is NULL pointer");
- if (!_is_init) return Status::InternalError("used before initialize.");
+
+ if (!_is_init) {
+ return Status::InternalError("used before initialize.");
+ }
RETURN_IF_CANCELLED(state);
bool mem_reuse = block->mem_reuse();
DCHECK(block->rows() == 0);
@@ -173,8 +176,8 @@ Status VMysqlScanNode::get_next(RuntimeState* state,
vectorized::Block* block, b
break;
}
- char** data = NULL;
- unsigned long* length = NULL;
+ char** data = nullptr;
+ unsigned long* length = nullptr;
RETURN_IF_ERROR(_mysql_scanner->get_next_row(&data, &length,
&mysql_eos));
if (mysql_eos) {
diff --git a/be/src/vec/exec/vrepeat_node.cpp b/be/src/vec/exec/vrepeat_node.cpp
index aa32990598..8a090ad0d6 100644
--- a/be/src/vec/exec/vrepeat_node.cpp
+++ b/be/src/vec/exec/vrepeat_node.cpp
@@ -226,13 +226,13 @@ bool VRepeatNode::need_more_input_data() const {
}
Status VRepeatNode::get_next(RuntimeState* state, Block* block, bool* eos) {
+ if (state == nullptr || block == nullptr || eos == nullptr) {
+ return Status::InternalError("input is nullptr");
+ }
INIT_AND_SCOPE_GET_NEXT_SPAN(state->get_tracer(), _get_next_span,
"VRepeatNode::get_next");
VLOG_CRITICAL << "VRepeatNode::get_next";
SCOPED_TIMER(_runtime_profile->total_time_counter());
- if (state == nullptr || block == nullptr || eos == nullptr) {
- return Status::InternalError("input is NULL pointer");
- }
RETURN_IF_CANCELLED(state);
DCHECK(_repeat_id_idx >= 0);
for (const std::vector<int64_t>& v : _grouping_list) {
diff --git a/be/src/vec/exec/vschema_scan_node.cpp
b/be/src/vec/exec/vschema_scan_node.cpp
index e38f9e0673..1bdd5c8563 100644
--- a/be/src/vec/exec/vschema_scan_node.cpp
+++ b/be/src/vec/exec/vschema_scan_node.cpp
@@ -105,7 +105,11 @@ Status VSchemaScanNode::init(const TPlanNode& tnode,
RuntimeState* state) {
}
Status VSchemaScanNode::open(RuntimeState* state) {
- START_AND_SCOPE_SPAN(state->get_tracer(), span, "AggregationNode::close");
+ if (nullptr == state) {
+ return Status::InternalError("input pointer is nullptr.");
+ }
+
+ START_AND_SCOPE_SPAN(state->get_tracer(), span, "VSchemaScanNode::open");
if (!_is_init) {
span->SetStatus(opentelemetry::trace::StatusCode::kError, "Open before
Init.");
return Status::InternalError("Open before Init.");
@@ -138,9 +142,9 @@ Status VSchemaScanNode::prepare(RuntimeState* state) {
}
if (nullptr == state) {
- return Status::InternalError("input pointer is nullptr.");
+ return Status::InternalError("state pointer is nullptr.");
}
-
+ START_AND_SCOPE_SPAN(state->get_tracer(), span,
"VSchemaScanNode::prepare");
RETURN_IF_ERROR(ScanNode::prepare(state));
SCOPED_CONSUME_MEM_TRACKER(mem_tracker_growh());
@@ -244,13 +248,13 @@ Status VSchemaScanNode::prepare(RuntimeState* state) {
}
Status VSchemaScanNode::get_next(RuntimeState* state, vectorized::Block*
block, bool* eos) {
+ if (state == nullptr || block == nullptr || eos == nullptr) {
+ return Status::InternalError("input is NULL pointer");
+ }
INIT_AND_SCOPE_GET_NEXT_SPAN(state->get_tracer(), _get_next_span,
"VSchemaScanNode::get_next");
SCOPED_TIMER(_runtime_profile->total_time_counter());
VLOG_CRITICAL << "VSchemaScanNode::GetNext";
- if (state == nullptr || block == nullptr || eos == nullptr) {
- return Status::InternalError("input is NULL pointer");
- }
if (!_is_init) {
return Status::InternalError("used before initialize.");
}
diff --git a/be/src/vec/functions/functions_multi_string_position.cpp
b/be/src/vec/functions/functions_multi_string_position.cpp
index c5da16d17d..756d561ee6 100644
--- a/be/src/vec/functions/functions_multi_string_position.cpp
+++ b/be/src/vec/functions/functions_multi_string_position.cpp
@@ -65,11 +65,12 @@ public:
const ColumnConst* col_needles_const =
check_and_get_column_const<ColumnArray>(needles_ptr.get());
- if (col_haystack_const && col_needles_vector)
+ if (col_haystack_const && col_needles_vector) {
return Status::InvalidArgument(
"function '{}' doesn't support search with non-constant
needles "
"in constant haystack",
name);
+ }
using ResultType = typename Impl::ResultType;
auto col_res = ColumnVector<ResultType>::create();
@@ -79,17 +80,20 @@ public:
auto& offsets_res = col_offsets->get_data();
Status status;
- if (col_needles_const)
+ if (col_needles_const) {
status = Impl::vector_constant(
col_haystack_vector->get_chars(),
col_haystack_vector->get_offsets(),
col_needles_const->get_value<Array>(), vec_res,
offsets_res);
- else
+ } else {
status = Impl::vector_vector(col_haystack_vector->get_chars(),
col_haystack_vector->get_offsets(),
col_needles_vector->get_data(),
col_needles_vector->get_offsets(),
vec_res, offsets_res);
+ }
- if (!status.ok()) return status;
+ if (!status.ok()) {
+ return status;
+ }
auto nullable_col =
ColumnNullable::create(std::move(col_res),
ColumnUInt8::create(col_res->size(), 0));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]