mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix UBSan report in Decimal parse
This commit is contained in:
parent
d1464a441f
commit
79af5cd0ae
@ -58,7 +58,7 @@ void DataTypeDecimal<T>::serializeText(const IColumn & column, size_t row_num, W
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool DataTypeDecimal<T>::tryReadText(T & x, ReadBuffer & istr, UInt32 precision, UInt32 scale)
|
||||
bool NO_SANITIZE_UNDEFINED DataTypeDecimal<T>::tryReadText(T & x, ReadBuffer & istr, UInt32 precision, UInt32 scale)
|
||||
{
|
||||
UInt32 unread_scale = scale;
|
||||
bool done = tryReadDecimalText(istr, x, precision, unread_scale);
|
||||
@ -68,7 +68,7 @@ bool DataTypeDecimal<T>::tryReadText(T & x, ReadBuffer & istr, UInt32 precision,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void DataTypeDecimal<T>::readText(T & x, ReadBuffer & istr, UInt32 precision, UInt32 scale, bool csv)
|
||||
void NO_SANITIZE_UNDEFINED DataTypeDecimal<T>::readText(T & x, ReadBuffer & istr, UInt32 precision, UInt32 scale, bool csv)
|
||||
{
|
||||
UInt32 unread_scale = scale;
|
||||
if (csv)
|
||||
@ -95,7 +95,7 @@ void DataTypeDecimal<T>::deserializeTextCSV(IColumn & column, ReadBuffer & istr,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T DataTypeDecimal<T>::parseFromString(const String & str) const
|
||||
T NO_SANITIZE_UNDEFINED DataTypeDecimal<T>::parseFromString(const String & str) const
|
||||
{
|
||||
ReadBufferFromMemory buf(str.data(), str.size());
|
||||
T x;
|
||||
|
@ -0,0 +1 @@
|
||||
0
|
1
tests/queries/0_stateless/01260_ubsan_decimal_parse.sql
Normal file
1
tests/queries/0_stateless/01260_ubsan_decimal_parse.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT ignore(toDecimal32OrZero(CAST(-7174046, 'String'), 6));
|
Loading…
Reference in New Issue
Block a user