diff options
Diffstat (limited to 'strings')
-rw-r--r-- | strings/decimal.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/strings/decimal.c b/strings/decimal.c index 8dbe1bd57f4..b0c57d3db0c 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1025,7 +1025,11 @@ int ulonglong2decimal(ulonglong from, decimal_t *to) int longlong2decimal(longlong from, decimal_t *to) { if ((to->sign= from < 0)) + { + if (from == LONGLONG_MIN) // avoid undefined behavior + return ull2dec((ulonglong)LONGLONG_MIN, to); return ull2dec(-from, to); + } return ull2dec(from, to); } |