[openssh-commits] [openssh] 01/01: upstream: Use int64_t for intermediate values in int32_MINMAX to
git+noreply at mindrot.org
git+noreply at mindrot.org
Thu Dec 31 12:42:22 AEDT 2020
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 3d999be7b987c848feda718cfcfcdc005ddf670d
Author: tobhe at openbsd.org <tobhe at openbsd.org>
Date: Wed Dec 30 14:13:28 2020 +0000
upstream: Use int64_t for intermediate values in int32_MINMAX to
prevent signed 32-bit integer overflow.
Found by and ok djm@
ok markus@
OpenBSD-Commit-ID: 4f0704768e34cf45fdd792bac4011c6971881bb3
---
int32_minmax.inc | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/int32_minmax.inc b/int32_minmax.inc
new file mode 100644
index 00000000..2f6ff519
--- /dev/null
+++ b/int32_minmax.inc
@@ -0,0 +1,20 @@
+/* $OpenBSD: int32_minmax.inc,v 1.1 2020/12/30 14:13:28 tobhe Exp $ */
+
+/*
+ * Public Domain, Authors:
+ * - Daniel J. Bernstein
+ * - Chitchanok Chuengsatiansup
+ * - Tanja Lange
+ * - Christine van Vredendaal
+ */
+
+#define int32_MINMAX(a,b) \
+do { \
+ int64_t ab = (int64_t)b ^ (int64_t)a; \
+ int64_t c = (int64_t)b - (int64_t)a; \
+ c ^= ab & (c ^ b); \
+ c >>= 31; \
+ c &= ab; \
+ a ^= c; \
+ b ^= c; \
+} while(0)
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list