File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -14,17 +14,18 @@ Types and Traits
1414 :category: types
1515 :recommendation: required
1616
17- Code must not rely on Rust's implicit integer wrapping behavior that occurs in release builds.
18- Instead, explicitly handle potential overflows using the standard library's checked,
17+ Code must not rely on Rust's implicit integer wrapping behavior that may occur in release
18+ builds. Instead, explicitly handle potential overflows using the standard library's checked,
1919 saturating, or wrapping operations.
2020
2121 .. rationale ::
2222 :id: rat_kYiIiW8R2qD1
2323 :status: draft
2424
2525 In debug builds, Rust performs runtime checks for integer overflow and will panic if detected.
26- However, in release builds (with optimizations enabled), integer operations silently wrap
27- around on overflow, creating potential for silent failures and security vulnerabilities.
26+ However, in release builds (with optimizations enabled), unless the flag overflow-checks is
27+ turned on, integer operations silently wrap around on overflow, creating potential for silent
28+ failures and security vulnerabilities.
2829
2930 Safety-critical software requires consistent and predictable behavior across all build
3031 configurations. Explicit handling of potential overflow conditions improves code clarity,
You can’t perform that action at this time.
0 commit comments