You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Russ Cox noticed that reset was clearing limbs up to the previous Nat
size, not up to the new size, because clear(x.limbs) was happening
before the x.limbs[:n] reslice.
That's potentially a severe issue, because it may leave garbage in
x.limbs[len(x.limbs):n] if n < cap(x.limbs).
We were saved by an accidental invariant caused by the bug itself,
though: x.limbs[len(x.limbs):cap(x.limbs)] are always zero.
reset was always clearing all exposed (and hence potentially non-zero)
limbs before shrinking the Nat, and the only other function that could
shrink the Nat was trim, which only trims zero limbs.
Near miss.
Preserve the accidental invariant in the fix, because memclr is cheap
and it just proved it can save us from potential mistakes.
The text was updated successfully, but these errors were encountered:
Russ Cox noticed that reset was clearing limbs up to the previous Nat
size, not up to the new size, because clear(x.limbs) was happening
before the x.limbs[:n] reslice.
That's potentially a severe issue, because it may leave garbage in
x.limbs[len(x.limbs):n] if n < cap(x.limbs).
We were saved by an accidental invariant caused by the bug itself,
though: x.limbs[len(x.limbs):cap(x.limbs)] are always zero.
reset was always clearing all exposed (and hence potentially non-zero)
limbs before shrinking the Nat, and the only other function that could
shrink the Nat was trim, which only trims zero limbs.
Near miss.
Preserve the accidental invariant in the fix, because memclr is cheap
and it just proved it can save us from potential mistakes.
The text was updated successfully, but these errors were encountered: