ML: fix panic in featuresToTensorAdvanced for 100/106/110-feature models - #72
Closed
Tumult1337 wants to merge 1 commit into
Closed
ML: fix panic in featuresToTensorAdvanced for 100/106/110-feature models#72Tumult1337 wants to merge 1 commit into
Tumult1337 wants to merge 1 commit into
Conversation
…dels featuresToTensorAdvanced wrote fixed offsets copy(tensor[95:105], ...) and copy(tensor[105:115], ...) unconditionally regardless of the allocated tensor length. LoadONNXModel's auto-detect probe includes sizes 100, 106, and 110 (onnx.go loadONNXModelInternal), all narrower than the fixed 115-index write, so a model auto-detected at one of those sizes panicked with a slice-bounds-out-of-range on the first prediction carrying event history, crashing the analyzer process (engine.Predict runs on the detection goroutine with no recover). Add copyTruncated, which clamps each write to the tensor's actual capacity, and route the fingerprint/behavioral feature copies through it so smaller auto-detected sizes get a truncated but valid tensor instead of a panic. Sizes >=116 are unaffected (the existing branches already guard capacity for those layouts).
awlx
added a commit
that referenced
this pull request
Aug 8, 2026
Owner
|
Superseded by and merged through #77, which preserves this contribution and includes the follow-up fixes. Thanks for the contribution! |
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.
Fix a panic in
featuresToTensorAdvancedfor 100/106/110-feature ONNX models (bounds-clamped feature copy).Validation:
go build ./...clean;go test ./pkg/mlpasses.