mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
53ee1a7826
mpz_div_2exp() was calling mpz_init_heap() on output parameter z without first freeing z's existing memory. When called from mpz_barrett_reduce() with pre-allocated temporaries, this caused memory leaks. Add mpz_clear(ctx, z) before mpz_init_heap() in both affected code paths, matching the pattern already used in mpz_mod_2exp(). Fixes ClusterFuzz issue detected with input "8.pow 7*2515881+186,8 ^4>>-509". Co-authored-by: Claude <noreply@anthropic.com>