upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bignum.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bignum.h')
-rw-r--r--src/bignum.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bignum.h b/src/bignum.h
index 9da104b..6a295b2 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -155,7 +155,9 @@ public:
155 for (int i = 0; i < 8; i++) 155 for (int i = 0; i < 8; i++)
156 { 156 {
157 unsigned char c = (n >> 56) & 0xff; 157 unsigned char c = (n >> 56) & 0xff;
158 n <<= 8; 158 n = (int64)((uint64)n << 8); // shift in unsigned space; <<= on a
159 // signed int64 with the top byte set
160 // is overflow UB (fuzzer/UBSan finding)
159 if (fLeadingZeroes) 161 if (fLeadingZeroes)
160 { 162 {
161 if (c == 0) 163 if (c == 0)