Commit b15e205438

Asherah Connor <ashe@kivikakk.ee>
2021-03-22 13:42:16
bigint: use a stack local here to prevent aliasing issues
1 parent 1db6018
Changed files (1)
lib
std
math
lib/std/math/big/int.zig
@@ -316,7 +316,9 @@ pub const Mutable = struct {
         }
 
         if (a.limbs.len == 1 and b.limbs.len == 1 and a.positive == b.positive) {
-            if (!@addWithOverflow(Limb, a.limbs[0], b.limbs[0], &r.limbs[0])) {
+            var o: Limb = undefined;
+            if (!@addWithOverflow(Limb, a.limbs[0], b.limbs[0], &o)) {
+                r.limbs[0] = o;
                 r.len = 1;
                 r.positive = a.positive;
                 return;