Fix release-build SIGSEGV in monotonic fill (stale right-horizontal link after vertical-run jump) - #11978
Open
gommzystudio wants to merge 1 commit into
Conversation
…ink after vertical-run jumps In both monotonic traversals (montonous_region_path_length and polylines_from_paths), iright tracks the right-horizontal link while a vertical run is consumed. When the traversal follows a vertical_up()/ vertical_down() link to another run on the same vline, the landing intersection's right_horizontal() was never folded into iright. If the only right link of the combined run lives at or after the landing point, iright stays -1 (or stale). The subsequent vline_right.intersections[iright] access is only guarded by an assert, which is compiled out in release builds, so release builds read out of bounds and crash with SIGSEGV (observed via Layer::make_ironing on real models), or silently traverse from a wrong intersection. Update iright at all four landing sites using the same idiom the surrounding loops already use (max while going up, last non -1 while going down). Paths that previously computed a valid iright are unaffected.
gommzystudio
marked this pull request as ready for review
August 21, 2026 09:05
BambulabRobot
requested review from
ShanCang-BamBu,
XunZhangBambu,
xing-mantian and
zhimin-zeng-bambulab
August 21, 2026 09:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a random release-build SIGSEGV in the monotonic fill traversal that we hit in production via top-surface ironing (
Layer::make_ironing()→FillRectilinear). The same input would sometimes slice fine and sometimes crash, because the crash depends on which intersection carries the right-horizontal link.Root cause
In both monotonic traversals in
src/libslic3r/Fill/FillRectilinear.cpp(montonous_region_path_lengthandpolylines_from_paths),irightaccumulates the right-horizontal link while a vertical run is consumed:iright = std::max(iright, it->right_horizontal());inside thedo-loopif (int iright_new = it->right_horizontal(); iright_new != -1) iright = iright_new;However, when the traversal follows a
vertical_up()/vertical_down()link to continue on another run of the same vline (it = vline.intersections.data() + inext;), the landing intersection'sright_horizontal()is never folded intoiright.If the only right link of the combined run lives at or after the landing point,
irightremains-1(or stale). The code afterwards does:Both asserts are compiled out in release builds, so
vline_right.intersections[iright]reads out of bounds withiright == -1(crash), or traverses from a wrong intersection with a stale index (silent misbehavior).Fix
Update
irightat all four vertical-jump landing sites, using exactly the idiom the surrounding loops already use (max while going up, last non--1while going down). Six added lines, no behavior change for paths that already computed a validiright.Validation
FillRectilinearduringLayer::make_ironing().The affected file is byte-identical between v02.06.00.51 and current
master, so the bug is still present on master.Notes
-1irightsilently continues from the wrong intersection instead of crashing.