Fix large string val allocation failure (#3724)

* Fix large string val allocation failure

Large bitmap will need use StringVal to allocate large memory, which is large than MAX_INT.
The overflow will cause serialization failure of bitmap.

Fixed #3600
This commit is contained in:
EmmyMiao87
2020-06-03 17:07:54 +08:00
committed by GitHub
parent 70aa9d6ca8
commit e16873a6c1
6 changed files with 17 additions and 15 deletions

View File

@ -488,7 +488,9 @@ StringVal BitmapFunctions::bitmap_from_string(FunctionContext* ctx, const String
}
std::vector<uint64_t> bits;
if (!SplitStringAndParse({(const char*)input.ptr, input.len}, ",", &safe_strtou64, &bits)) {
// The contructor of `stringpiece` only support int type.
if ((input.len > INT32_MAX)
|| !SplitStringAndParse({(const char*)input.ptr, (int)input.len}, ",", &safe_strtou64, &bits)) {
return StringVal::null();
}