Advisory

GHSA-q6rr-fm2g-g5x8

Details, part 2 of 2. The advisory

Details

Suggested remediation

Apply the same hardening already used on the sibling operations, in ScriptArray.cs (Multiply case, :504-508):

  • Mirror `array.insert_at`: call context.StepLoop(span, ref loopStep) inside the fill loop so LoopLimit is enforced; or
  • **Mirror string * int:** pre-check the result size with overflow-safe arithmetic before allocating, e.g. if (context.LimitToString > 0 && (long)intModifier * array.Count > context.LimitToString) throw new ScriptRuntimeException(...), and compute the capacity as long (or reject negative/overflowing products) to remove the integer-overflow path.

Add a regression test that asserts a graceful ScriptRuntimeException for a large multiplier (e.g. [1,2,3,4,5] * 50000000) rather than allowing the allocation to proceed.

Sources & licences