From b15e2054384ba683499138fcad0a9503f3aa9e0b Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Mon, 22 Mar 2021 23:42:16 +1100 Subject: [PATCH] bigint: use a stack local here to prevent aliasing issues --- lib/std/math/big/int.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/std/math/big/int.zig b/lib/std/math/big/int.zig index 7c77b5a0a1..f52495b739 100644 --- a/lib/std/math/big/int.zig +++ b/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;