diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:18:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:18:03 +0000 |
commit | b4b8efbd3826ac0af2d1c2e7c40fcf80a4bfba45 (patch) | |
tree | bec866278030c41c624a91037b1dd88f41c99d8e /src/include/common/int.h | |
parent | Adding upstream version 15.5. (diff) | |
download | postgresql-15-66f7806ccd3f001bf96b8d5d153b7eaa82bc10cf.tar.xz postgresql-15-66f7806ccd3f001bf96b8d5d153b7eaa82bc10cf.zip |
Adding upstream version 15.6.upstream/15.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/include/common/int.h')
-rw-r--r-- | src/include/common/int.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/include/common/int.h b/src/include/common/int.h index 12a269d..e2617fb 100644 --- a/src/include/common/int.h +++ b/src/include/common/int.h @@ -200,8 +200,12 @@ pg_sub_s64_overflow(int64 a, int64 b, int64 *result) *result = (int64) res; return false; #else + /* + * Note: overflow is also possible when a == 0 and b < 0 (specifically, + * when b == PG_INT64_MIN). + */ if ((a < 0 && b > 0 && a < PG_INT64_MIN + b) || - (a > 0 && b < 0 && a > PG_INT64_MAX + b)) + (a >= 0 && b < 0 && a > PG_INT64_MAX + b)) { *result = 0x5EED; /* to avoid spurious warnings */ return true; |