Merge pull request #62610 from ClickHouse/fix-msan-uuid-string-to-num

Fix: msan in UUIDStringToNum
This commit is contained in:
Igor Nikonov 2024-04-29 11:56:10 +00:00 committed by GitHub
commit f22c27c76b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View File

@ -130,6 +130,7 @@ UUIDSerializer::Variant parseVariant(const DB::ColumnsWithTypeAndName & argument
const auto representation = static_cast<magic_enum::underlying_type_t<UUIDSerializer::Variant>>(arguments[1].column->getInt(0));
const auto as_enum = magic_enum::enum_cast<UUIDSerializer::Variant>(representation);
if (!as_enum)
throw DB::Exception(DB::ErrorCodes::ARGUMENT_OUT_OF_BOUND, "Expected UUID variant, got {}", representation);
@ -170,6 +171,7 @@ public:
}
bool useDefaultImplementationForConstants() const override { return true; }
ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {1}; }
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t /*input_rows_count*/) const override
{
@ -248,6 +250,7 @@ public:
}
bool useDefaultImplementationForConstants() const override { return true; }
ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {1}; }
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t /*input_rows_count*/) const override
{

View File

@ -0,0 +1,2 @@
3"\0UDwfˆ™ª»ÌÝîÿ
a/<@];!~p{jTj={) 403c2f61-3b5d-7e21-707b-6a546a3d7b29

View File

@ -0,0 +1,4 @@
SELECT UUIDStringToNum('00112233-4455-6677-8899-aabbccddeeff', 2);
SELECT UUIDStringToNum('00112233-4455-6677-8899-aabbccddeeff', materialize(2)); -- { serverError ILLEGAL_COLUMN }
SELECT 'a/<@];!~p{jTj={)' AS bytes, UUIDNumToString(toFixedString(bytes, 16), 2) AS uuid;
SELECT 'a/<@];!~p{jTj={)' AS bytes, UUIDNumToString(toFixedString(bytes, 16), materialize(2)) AS uuid; -- { serverError ILLEGAL_COLUMN }