From 44a69d866e6b30fcf194f1817d6e398a23c80665 Mon Sep 17 00:00:00 2001 From: Vlad Khorsun Date: Fri, 24 May 2024 15:27:41 +0300 Subject: [PATCH] Simplest fix for bug #8120 : Cast dies with numeric value is out of range error (5.0.1 snapshot) --- src/common/cvt.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp index 5fa6612d71..921fb93f4b 100644 --- a/src/common/cvt.cpp +++ b/src/common/cvt.cpp @@ -2577,9 +2577,10 @@ static SSHORT cvt_get_short(const dsc* desc, SSHORT scale, DecimalStatus decSt, const char* p; USHORT length = CVT_make_string(desc, ttype_ascii, &p, &buffer, sizeof(buffer), decSt, err); - RetValue rv(&value); - scale -= cvt_decompose(p, length, &rv, err); - + { + RetValue rv(&value); + scale -= cvt_decompose(p, length, &rv, err); + } adjustForScale(value, scale, SHORT_LIMIT, err); } else { @@ -4793,8 +4794,10 @@ SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, DecimalStatus decSt, ErrorFunc CVT_make_string(desc, ttype_ascii, &p, &buffer, sizeof(buffer), decSt, err); SINT64 i64; - RetValue rv(&i64); - scale -= cvt_decompose(p, length, &rv, err); + { + RetValue rv(&i64); + scale -= cvt_decompose(p, length, &rv, err); + } SINT64_to_SQUAD(i64, value); } break;