Commit 3472e2f
committed
Merge #81: Avoid overflowing shift by special casing inverse of 1
653d8b2 Avoid overflowing shift by special casing inverse of 1 (Pieter Wuille)
Pull request description:
When `x=1`, then `rlen = BITS+1` and `newrlen = 1`, and thus in the first loop iteration `q = BITS`, leading to a shift by `BITS` bits, which may overflow the integer type.
Avoid this situation by special casing `x=1`. The inverse of `1` is always `1` anyway.
ACKs for top commit:
theuni:
Trivial ACK 653d8b2. This does that :)
Tree-SHA512: 32b1bc859c5d934b11ab3f6bc388d59a07c1155184135fee47e1f73c0d5b2bd1b325b9b111b7fe552c1d8bb0cb3214f214fa72b1024b5fadad0dd363f65559eb1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| 197 | + | |
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
| |||
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
255 | | - | |
| 256 | + | |
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
| |||
0 commit comments