Fix CLI multi-color slicing crash for single-extruder AMS printers (P1S/P1P/X1C)#10466
Open
ryanhebert wants to merge 1 commit intobambulab:masterfrom
Open
Fix CLI multi-color slicing crash for single-extruder AMS printers (P1S/P1P/X1C)#10466ryanhebert wants to merge 1 commit intobambulab:masterfrom
ryanhebert wants to merge 1 commit intobambulab:masterfrom
Conversation
Three fixes in update_values_to_printer_extruders_for_multiple_filaments() and update_values_to_printer_extruders(): 1. Add null check for filament_map option - not initialized in CLI mode, causing null pointer dereference at line 8460. 2. Add null checks for extruder_type and nozzle_volume_type options - may not be present when profiles are loaded standalone via CLI. 3. Clamp array index in get_at() calls - filament_maps contains AMS slot numbers (e.g., [3, 4, 1]) which exceed the extruder_type and nozzle_volume_type array sizes (typically 1-2 entries) on single-extruder AMS printers like P1S, P1P, X1C. Without these fixes, CLI multi-color slicing via --load-assemble-list crashes with ACCESS_VIOLATION after slicing completes successfully. Fixes bambulab#10465
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 ACCESS_VIOLATION crash in CLI multi-color slicing when using
--load-assemble-listwith single-extruder AMS printers.Changes
Three fixes in
src/libslic3r/PrintConfig.cpp:Null check for
filament_map(line 8460):printer_config.option<ConfigOptionInts>("filament_map")returns null in CLI mode sincefilament_mapis initialized by the GUI workflow. Added null check with early return.Null checks for
extruder_typeandnozzle_volume_type(lines 8465-8466):dynamic_castreturns null when these options aren't present in standalone profile files. Added null check with early return.Bounds clamping on
get_at()calls (lines 8478-8479, 8265):filament_mapscontains AMS slot numbers (e.g.,[3, 4, 1]) used as indices intoextruder_type/nozzle_volume_typearrays that typically have only 1-2 entries.get_at(3)on a 2-element array → out-of-bounds → crash. Fixed withstd::clamp().Root Cause
For single-extruder AMS printers (P1S, P1P, X1C),
support_different_extruders()returnstruedue toextruder_variant_list: ["Direct Drive Standard", "Direct Drive High Flow"]. This triggers the multi-extruder code path inupdate_values_to_printer_extruders_for_multiple_filaments(), which accesses fields that are either uninitialized (CLI mode) or have fewer entries than the filament map indices expect.Testing
CLI command that crashes before fix:
Crash trace:
Fixes #10465
Note: Same fix submitted to OrcaSlicer at OrcaSlicer/OrcaSlicer#13406