You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generated simulation and layout functions index past arrays or divide by zero for out-of-range counts #410
Four functions index past their array, or divide by zero, for some inputs. The generated Rust then panics. The generated C reads out of bounds or traps with SIGFPE, and Zig safety checks trap. These hazards predate #409, which made these modules compile in Rust. They are not part of #399.
Reproduced on fix/rust-corpus-399 (59f39b6) with Rust 1.96.0, by calling the generated gen/rust modules directly:
division by zero (nodes_per_level = node_count / 4)
network_simulator::process_event is safe: get_event_node_id masks the node id to 0..15.
Boundary:
The fix goes in specs/network_simulator.t27, specs/traffic_animator.t27 and specs/topology_visualizer.t27, with the pinned t27c regeneration of all three backends. Generated files are not edited by hand.
Public argument and return types stay unchanged.
Scenarios:
An out-of-range id or count returns the module's existing failure value, or is clamped to the array length. The spec documents which.
calculate_hierarchical_layout with node_count 0..3 returns without dividing by zero.
Requirements:
A test block in each spec covers the boundary inputs above.
A Rust test in tests/ exercises the same inputs against gen/rust.
Success criteria:
Every input in the table returns a defined value in Rust, C and Zig.
The drift, Zig, C, Icarus and the gen_rust_corpus_compiles gates stay green.
Activity