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
Size the gathered Jacobian by the true selected-row nnz sum (#105)
sparse_index_alloc capped the output capacity at the source's total nnz,
a bound that only holds for distinct (selection/permutation) indices.
A gather with enough DUPLICATED indices selects more entries than the
source has (e.g. x[[0,0,1,2,2,3]] on a size-4 variable: 6 > 4), and the
fill loop wrote the excess past the end of the buffers, corrupting the
heap (cvxpy#3442 — DNLP segfault during derivative-structure init).
Sum the selected rows' nnz for an exact allocation. The sum replaces the
sat_mul_int dense bound; a checked add errors out before wrapping if the
true count is not CSR-representable.
New tests (verified to hit heap-buffer-overflow under ASan without the
fix): the gather Jacobian itself, and the jacobian + weighted-sum
Hessian of multiply(a[idx], b[idx]) mirroring the issue.
Co-authored-by: Transurgeon <peter.zijie@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
0 commit comments