Reproduce
- New document
- Open node graph
- Create «Path node»
- Connect output to «Index Points»
- Connect output to the «Line» node (you must expose one of the inputs to the node graph by clicking on the circle)
- Connect output to graph output
Reproduction file: index_points_underflow.graphite.json (file -> open then remove any file extension filtering to see it)
Cause
The crash only occurs in debug mode:
frontend/wasm/src/lib.rs:45
Node graph evaluation panicked panicked at node-graph/nodes/vector/src/vector_nodes.rs:2283:30:
attempt to subtract with overflow
If index is >= 0 (as is default) and points_count is 0 then there is underflow
|
let points_count = content.iter().map(|row| row.element.point_domain.positions().len()).sum::<usize>(); |
|
|
|
// Clamp and allow negative indexing from the end |
|
let index = index as isize; |
|
let index = if index < 0 { |
|
(points_count as isize + index).max(0) as usize |
|
} else { |
|
(index as usize).min(points_count - 1) |
|
}; |
Reproduce
Reproduction file: index_points_underflow.graphite.json (
file -> openthen remove any file extension filtering to see it)Cause
The crash only occurs in debug mode:
If index is >= 0 (as is default) and
points_countis 0 then there is underflowGraphite/node-graph/nodes/vector/src/vector_nodes.rs
Lines 2276 to 2284 in 1b91198