mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Apply harmful library only for clickhouse binary
This commit is contained in:
parent
42a4e38f08
commit
bef492240c
@ -1,3 +1,2 @@
|
||||
add_library(harmful harmful.c)
|
||||
target_link_libraries(global-libs INTERFACE harmful)
|
||||
install(TARGETS harmful EXPORT global ARCHIVE DESTINATION lib)
|
||||
|
@ -207,7 +207,7 @@ if (CLICKHOUSE_SPLIT_BINARY)
|
||||
install(PROGRAMS clickhouse-split-helper DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME clickhouse COMPONENT clickhouse)
|
||||
else ()
|
||||
add_executable (clickhouse main.cpp)
|
||||
target_link_libraries (clickhouse PRIVATE clickhouse_common_io string_utils)
|
||||
target_link_libraries (clickhouse PRIVATE clickhouse_common_io string_utils harmful)
|
||||
target_include_directories (clickhouse PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if (ENABLE_CLICKHOUSE_SERVER)
|
||||
|
@ -61,9 +61,10 @@ public:
|
||||
return std::make_shared<DataTypeUInt8>();
|
||||
}
|
||||
|
||||
[[clang::optnone]] void executeImpl(Block & columns, const ColumnNumbers & arguments, size_t result, size_t input_rows_count) const override
|
||||
[[clang::optnone]]
|
||||
ColumnPtr executeImpl(const ColumnsWithTypeAndName & block, const DataTypePtr & result_type, size_t input_rows_count) const override
|
||||
{
|
||||
if (const ColumnConst * column = checkAndGetColumnConst<ColumnString>(columns[arguments[0]].column.get()))
|
||||
if (const ColumnConst * column = checkAndGetColumnConst<ColumnString>(block[0].column.get()))
|
||||
{
|
||||
String mode = column->getValue<String>();
|
||||
|
||||
@ -135,6 +136,15 @@ public:
|
||||
{
|
||||
(void)context.getCurrentQueryId();
|
||||
}
|
||||
else if (mode == "stack overflow")
|
||||
{
|
||||
executeImpl(block, result_type, input_rows_count);
|
||||
}
|
||||
else if (mode == "harmful function")
|
||||
{
|
||||
double res = drand48();
|
||||
(void)res;
|
||||
}
|
||||
else if (mode == "mmap many")
|
||||
{
|
||||
std::vector<void *> maps;
|
||||
@ -160,7 +170,7 @@ public:
|
||||
else
|
||||
throw Exception("The only argument for function " + getName() + " must be constant String", ErrorCodes::ILLEGAL_COLUMN);
|
||||
|
||||
columns[result].column = columns[result].type->createColumnConst(input_rows_count, 0ULL);
|
||||
return result_type->createColumnConst(input_rows_count, 0ULL);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user