Skip to content

Reject sources with a different SIMD feature set in metadata setters - #205

Merged
Auburn merged 3 commits into
masterfrom
claude/friendly-bardeen-db4e6d-source-feature-set
Oct 21, 2026
Merged

Auburn merged 3 commits into
masterfrom
claude/friendly-bardeen-db4e6d-source-feature-set

Conversation

@Auburn

@Auburn Auburn commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Problem

A node calls its sources through their SIMD class for its own feature set. When a source with a different feature set was connected, the only check was an assert:

  • assert( GetActiveFeatureSet() == gen->GetActiveFeatureSet() ) in SetSourceMemberVariable
  • assert( simd ) in SetSourceSIMDPtr

In release, the source's SIMD pointer was silently set to null. Meanwhile the metadata setFunc/setNodeFunc only dynamic_cast to the node types, which succeeds at any level, and returned true. So:

  • fnSetNodeLookup reported success, then generation segfaulted.
  • fnSetHybridNodeLookup reported success, then the node silently kept using its constant value.

Fix

The four metadata source setters return false, without changing the node, when the source's feature set differs from the node's:

  • AddGeneratorSource
  • AddPerDimensionGeneratorSource
  • AddHybridSource
  • AddPerDimensionHybridSource

The check runs after the target cast, so a null target still just returns false, as on master.

The C API and Metadata.h docs list the new false case. The C++ SetSource* functions keep their debug assert.

Output change

None. The decoder and benchmark always create every node at the same level.

Testing

Through the C API, with an SSE2 Add/FractalFBm and SSE2 and AVX2 Simplex sources:

Call master this PR
fnSetNodeLookup( Add, LHS, AVX2 Simplex ) returns 1, generate segfaults returns 0
fnSetHybridNodeLookup( FBm, Gain, AVX2 Simplex ) returns 1, output equals constant gain returns 0
same-level sources work work, same values
setFunc / setNodeFunc with a null target (CreateNode( SCALAR )) returns 0 returns 0

The 196-row node-type compare (every node type on all four feature sets) is bit-identical.


Generated by Claude Code

claude and others added 3 commits October 15, 2026 22:05
A node reaches its sources through their SIMD class for its own feature
set. Connecting a source created with a different feature set only hit
an assert, in release the source's SIMD pointer was silently set to
null: generation then crashed for a node lookup, or silently used the
constant value for a hybrid. The metadata setFunc/setNodeFunc still
returned true, so fnSetNodeLookup/fnSetHybridNodeLookup reported
success.

The metadata source setters now return false when the feature sets
differ, without changing the node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L2fYx8k4WU6rhiZF3mEwgP
The feature set check ran before the target generator was cast, so a
null target (e.g. from CreateNode below the minimum compiled feature
set) was dereferenced instead of making the setter return false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L2fYx8k4WU6rhiZF3mEwgP
Declare the cast result on its own line and test it in a plain if
condition, keeping the feature set check after the null check.
@Auburn
Auburn merged commit bf7a921 into master Oct 21, 2026
8 checks passed
@Auburn
Auburn deleted the claude/friendly-bardeen-db4e6d-source-feature-set branch October 21, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants