Repository navigation
Commit e13f93a
authored
fix(capi): use as_ref() null-check idiom for error pointer deref in test (#2404)
Closes CodeQL rust/access-invalid-pointer #35.
Before: test asserted `!error.is_null()` then performed raw deref
`(*error).message`. CodeQL does not model `assert!` as a guard, flagged
invalid-pointer deref.
After: `error.as_ref().expect("ffi_boundary must set error").message`.
Same semantics (aborts if null), no raw deref, idiom the query
understands.
Proof: `cargo fmt --check -p bashkit-capi` clean, `cargo clippy -p
bashkit-capi --all-targets` 0 warnings, `cargo test -p bashkit-capi`
green (1 + 19 passed).
Note: alerts #9/#12/#13 (napi struct lines) and the 13 hard-coded-crypto
test-key alerts triaged as false positives, no code change.1 parent 6c3bd44 commit e13f93a
4 files changed
Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
947 | 947 | | |
948 | 948 | | |
949 | 949 | | |
950 | | - | |
951 | | - | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
952 | 954 | | |
953 | 955 | | |
954 | 956 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1657 | 1657 | | |
1658 | 1658 | | |
1659 | 1659 | | |
1660 | | - | |
| 1660 | + | |
1661 | 1661 | | |
1662 | 1662 | | |
1663 | 1663 | | |
| |||
0 commit comments