mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-15 23:12:08 +00:00
GCode::extrude_support declared its per-path speed helper as a function-local static lambda that captures `this` by reference. The closure is built once, on the first extrude_support call, and reused for the rest of the process, so a second G-code export in the same process runs the helper against a `this` from the first export's stack frame, which has already returned. The stale `this` flows through NOZZLE_CONFIG(...) -> cur_extruder_index() -> GCodeWriter::filament(), reading a garbage current-extruder id and indexing with it. It is silent whenever the reused stack still holds a usable pointer, and an order-dependent SIGSEGV otherwise; AddressSanitizer reports it as a stack-use-after-return in GCodeWriter::filament(). It is the only static capturing lambda in libslic3r. Drop static so the closure is rebuilt each call against the live frame. Add an fff_print regression test that slices a support object twice in one process; it fails without the fix (stack-use-after-return under ASan) and passes with it.
4.7 KiB
4.7 KiB