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
{{ message }}
Repository navigation
fix(stl): prevent vector range-insert overflow when growth fails #4524
vector::insert(pos, first, last) increments count for every source element even if push_back could not grow storage. It then computes src_start = mSize - count; on partial or total allocation failure this can underflow and the swap loop can access outside the array. The vector's allocation path is no-throw, so failure must be handled explicitly.
Repro: use a rejecting/fixed-capacity memory_resource, then insert a range larger than available capacity into a nonempty vector.
Proposal
Count only successful appends and define safe, consistent failure behavior before rotating appended elements.
Acceptance criteria
Add a focused RED→GREEN allocation-failure regression using an injectable resource, with release-mode sanitizer coverage where assertions do not mask the failure.
No underflow or out-of-bounds access occurs; original elements remain valid and insertion result/state is documented.
Successful range insertion behavior remains unchanged.
Decisions
Priority: high because allocation pressure can turn a recoverable failure into memory corruption.
The test must account for debug assertion behavior so it exercises the no-throw failure path.
Activity