Files
mruby-mruby/mrbgems/mruby-bigint/core
Yukihiro "Matz" Matsumoto 29b3405283 bigint.c: handle in-place operation in mpz_mod_2exp()
when mpz_mod_2exp() is called with z == x (in-place operation), the
function was calling mpz_clear(ctx, z) which freed x's memory, then
attempting to access x->p[i] - reading freed memory. this caused
Barrett reduction to produce incorrect results in modular
exponentiation.

the fix checks if z == x and handles in-place modification by
adjusting the size and masking directly, without clearing. this is
similar to the memory leak fix for pool→heap transitions.

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-01 18:20:44 +09:00
..
2025-05-14 02:01:02 +10:00