BLI: fix finding indices from virtual array
The sorting of index vectors assumed that all vectors have at least one element. Now this is checked for more explicitely.
This commit is contained in:
parent
bcdce4ffd8
commit
c8a07ef663
Notes:
blender-bot
2023-06-21 19:23:24 +02:00
Referenced by issue #99705, Out-of-bounds memory access due to blender-thumbnailer Referenced by issue #99692, Crash (assert) in debug build in extrude node or capture attribute node.
|
@ -142,6 +142,7 @@ IndexMask find_indices_based_on_predicate__merge(
|
|||
int64_t result_mask_size = 0;
|
||||
for (Vector<Vector<int64_t>> &local_sub_masks : sub_masks) {
|
||||
for (Vector<int64_t> &sub_mask : local_sub_masks) {
|
||||
BLI_assert(!sub_mask.is_empty());
|
||||
all_vectors.append(&sub_mask);
|
||||
result_mask_size += sub_mask.size();
|
||||
}
|
||||
|
@ -232,7 +233,9 @@ IndexMask find_indices_from_virtual_array(const IndexMask indices_to_check,
|
|||
}
|
||||
}
|
||||
});
|
||||
sub_masks.local().append(std::move(masked_indices));
|
||||
if (!masked_indices.is_empty()) {
|
||||
sub_masks.local().append(std::move(masked_indices));
|
||||
}
|
||||
});
|
||||
|
||||
return detail::find_indices_based_on_predicate__merge(indices_to_check, sub_masks, r_indices);
|
||||
|
|
Loading…
Reference in New Issue