mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-05 14:51:06 +00:00
Painting: guard the top/bottom projection erase when no shell layers are requested
With top_shell_layers = 0 the `top` vector is never filled and erasing its begin() was undefined (found by fuzzing on a painted object dropped below the plate).
This commit is contained in:
@@ -1244,10 +1244,16 @@ static inline std::vector<std::vector<ExPolygons>> segmentation_top_and_bottom_l
|
||||
slicing_params.trafo = volume_trafo;
|
||||
Polygons bottom_slice = slice_mesh(painted, zs[0], slicing_params);
|
||||
|
||||
top.erase(top.begin());
|
||||
bottom.erase(bottom.begin());
|
||||
|
||||
bottom[0] = union_(bottom[0], bottom_slice);
|
||||
// Only the requested projections exist: with
|
||||
// top_shell_layers = 0 `top` is empty and erasing its begin() was
|
||||
// undefined (found by fuzzing: a sunk, painted object crashed here).
|
||||
if (! top.empty())
|
||||
top.erase(top.begin());
|
||||
if (! bottom.empty()) {
|
||||
bottom.erase(bottom.begin());
|
||||
if (! bottom.empty())
|
||||
bottom[0] = union_(bottom[0], bottom_slice);
|
||||
}
|
||||
} else
|
||||
slice_mesh_slabs(painted, zs, volume_trafo, max_top_layers > 0 ? &top : nullptr, max_bottom_layers > 0 ? &bottom : nullptr, nullptr, throw_on_cancel_callback);
|
||||
auto merge = [](std::vector<Polygons> &&src, std::vector<Polygons> &dst) {
|
||||
|
||||
Reference in New Issue
Block a user