Fix crash in normalize_fdm when nozzle_diameter is absent - #761
Open
Megarushing wants to merge 1 commit into
Open
Fix crash in normalize_fdm when nozzle_diameter is absent#761Megarushing wants to merge 1 commit into
Megarushing wants to merge 1 commit into
Conversation
normalize_fdm() dereferences the result of opt<ConfigOptionFloats>("nozzle_diameter")
unconditionally while normalizing wipe_tower_filament. nozzle_diameter is a printer
option, so it is missing whenever the config being normalized holds print settings
only, and opt<T>() then returns nullptr. Calling ->size() on it crashes.
Guard the lookup and keep the existing clamping when the option is present.
|
Independent integration check on current upstream This is evidence for the combined headless path and compatibility with #803, not a claim that the complete result is attributable to #761 alone. |
This was referenced Aug 31, 2026
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.
Description
Fixes #689.
DynamicPrintConfig::normalize_fdm()crashes with a null dereference whenever itnormalizes a configuration that contains print settings but no printer settings.
wipe_tower_filamentis a print (process) option, whilenozzle_diameteris aprinter option. A process preset therefore satisfies the
has()guard but does notcontain
nozzle_diameter.ConfigBase::opt<T>()isdynamic_cast<const T*>(this->option(opt_key)), so it returnsnullptrin that caseand
->size()dereferences it.The most direct way to reach this is the CLI, where a process preset is loaded on its
own:
Any U1 process preset reproduces it. Loading stops immediately after
load setting file .../process.json, with rule 1, with no further output.On Linux this is a
SIGSEGV(exit-11); #689 reports the same failure on Windows as0xC0000005. A debugger places the crash inDynamicPrintConfig::normalize_fdm(int), called from theload_config_filelambda inCLI::run— that is, during config normalization right afterDynamicPrintConfig::load_from_json(), before compatibility checking, filamentloading, arranging or slicing.
Single-variable confirmation: removing only the
wipe_tower_filamentkey from theprocess JSON, changing nothing else, turns the identical command into a complete
slice that writes
plate_1.gcodeand exits0. Restoring the key restores the crash.Upstream OrcaSlicer no longer contains this block in
normalize_fdm()at all, so thecrash is specific to this fork.
The change
Guard the
nozzle_diameterlookup instead of dereferencing it unconditionally, andkeep the existing clamping behaviour when the option is present:
This mirrors how upstream guards the same option elsewhere
(
auto* nd = cfg.opt<ConfigOptionFloats>("nozzle_diameter"); if (nd && ...)).Behaviour is unchanged for every configuration that includes printer settings, which
covers the GUI and any project-file path: the option is present, the branch is taken,
and the clamp runs exactly as before. Only the previously crashing case changes, and
there the clamp is meaningless because the extruder count is unknown.
Deleting the block entirely, as upstream did, is also defensible. I kept the minimal
guard so the existing intent is preserved.
Screenshots/Recordings/Graphs
Not applicable — no UI change.
Tests
(internal engine
01.10.01.50) with manifest-correct flattened U1 machine, processand filament JSON: deterministic
SIGSEGV, return-11, five runs out of five.DynamicPrintConfig::normalize_fdm(int)→CLI::run'sload_config_filelambda.wipe_tower_filamentremoved the samecommand slices 98 layers, writes
plate_1.gcodeand a successfulresult.json, andexits
0.opt<T>()returnsnullptrrather than throwing for an absent key, so theguard is the correct shape, and checked the guarded control flow in isolation.
I was not able to build the full application in this environment, so the patched source
has not been compiled. The change is small and local, but please run it through CI
before merging.