[fix](memory) Fix too many repeat cause OOM (#15217)

This commit is contained in:
Xinyi Zou
2022-12-22 17:16:18 +08:00
committed by GitHub
parent 6fb61b5bbc
commit 77c15729d4
6 changed files with 37 additions and 11 deletions

View File

@ -165,13 +165,14 @@ TEST(function_string_test, function_string_repeat_test) {
std::string func_name = "repeat";
InputTypeSet input_types = {TypeIndex::String, TypeIndex::Int32};
DataSet data_set = {{{std::string("a"), 3}, std::string("aaa")},
{{std::string("hel lo"), 2}, std::string("hel lohel lo")},
{{std::string("hello word"), -1}, std::string("")},
{{std::string(""), 1}, std::string("")},
{{std::string("134"), 1073741825}, Null()}, // bigger than 1GB
{{std::string("HELLO,!^%"), 2}, std::string("HELLO,!^%HELLO,!^%")},
{{std::string(""), 2}, std::string("你你")}};
DataSet data_set = {
{{std::string("a"), 3}, std::string("aaa")},
{{std::string("hel lo"), 2}, std::string("hel lohel lo")},
{{std::string("hello word"), -1}, std::string("")},
{{std::string(""), 1}, std::string("")},
{{std::string("a"), 1073741825}, std::string("aaaaaaaaaa")}, // ut repeat max num 10
{{std::string("HELLO,!^%"), 2}, std::string("HELLO,!^%HELLO,!^%")},
{{std::string(""), 2}, std::string("你你")}};
check_function<DataTypeString, true>(func_name, input_types, data_set);
}