Backport #64024 to 24.3: Deserialize untrusted binary inputs in a safer way

This commit is contained in:
robot-clickhouse 2024-05-19 09:04:44 +00:00
parent 8506b1fd63
commit d6edd8f64d

View File

@ -20,6 +20,7 @@ namespace ErrorCodes
{
extern const int CANNOT_RESTORE_FROM_FIELD_DUMP;
extern const int DECIMAL_OVERFLOW;
extern const int INCORRECT_DATA;
}
inline Field getBinaryValue(UInt8 type, ReadBuffer & buf)
@ -140,7 +141,7 @@ inline Field getBinaryValue(UInt8 type, ReadBuffer & buf)
case Field::Types::CustomType:
return Field();
}
UNREACHABLE();
throw Exception(ErrorCodes::INCORRECT_DATA, "Unknown field type {}", std::to_string(type));
}
void readBinary(Array & x, ReadBuffer & buf)