putil: Fix out-of-bounds read in SparseArray uncovered by ASan

This commit is contained in:
rdb 2026-01-24 20:23:13 +01:00
parent 0210384615
commit c2760c88c6
1 changed files with 4 additions and 0 deletions

View File

@ -588,6 +588,10 @@ do_intersection(const SparseArray &other) {
do_remove_range(other._subranges[i]._end, other._subranges[i + 1]._begin);
}
if (_subranges.empty()) {
return;
}
int my_end = (*(_subranges.begin() + _subranges.size() - 1))._end;
int other_end = (*(other._subranges.begin() + other._subranges.size() - 1))._end;
do_remove_range(other_end, my_end);