Fix UBSan report in Decimal parse

This commit is contained in:
Alexey Milovidov 2020-04-26 18:48:30 +03:00
parent d1464a441f
commit 79af5cd0ae
3 changed files with 5 additions and 3 deletions

View File

@ -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;

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1 @@
SELECT ignore(toDecimal32OrZero(CAST(-7174046, 'String'), 6));