diff --git a/ydb/library/yql/public/decimal/ut/yql_decimal_ut.cpp b/ydb/library/yql/public/decimal/ut/yql_decimal_ut.cpp index 05b141362282..b03a34ee45cb 100644 --- a/ydb/library/yql/public/decimal/ut/yql_decimal_ut.cpp +++ b/ydb/library/yql/public/decimal/ut/yql_decimal_ut.cpp @@ -232,6 +232,7 @@ Y_UNIT_TEST_SUITE(TYqlDecimalTest) { UNIT_ASSERT(IsError(FromStringEx("-infe-5", 35, 15))); // inf with exp UNIT_ASSERT(IsError(FromStringEx("2.1E0X", 35, 2))); // not fully parsed exp UNIT_ASSERT(IsError(FromStringEx("2.1E+-1", 35, 2))); // two signs + UNIT_ASSERT(IsError(FromStringEx("ae30", 10, 0))); // bad mantissa } Y_UNIT_TEST(TestSpecialAsString) { diff --git a/ydb/library/yql/public/decimal/yql_decimal.cpp b/ydb/library/yql/public/decimal/yql_decimal.cpp index ea444a06b260..91564a1a5f1f 100644 --- a/ydb/library/yql/public/decimal/yql_decimal.cpp +++ b/ydb/library/yql/public/decimal/yql_decimal.cpp @@ -238,7 +238,7 @@ TInt128 FromStringEx(const TStringBuf& str, ui8 precision, ui8 scale) { FromString(str.Head(len), precision, std::min(s, p)): FromString(str.Head(len), std::min(p - exp, int(MaxPrecision)), std::max(s, 0)); - if (IsNan(r)) { + if (IsError(r) || IsNan(r)) { return Err(); }