fix(drive): replace unchecked integer casts with try_from#3201
Conversation
- store_nullifiers: `nullifiers.len() as i64` → `i64::try_from()` - verify_shielded_nullifiers: `nullifiers.len() as u16` → `u16::try_from()` Both now return proper errors instead of silently truncating. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ DashSDKFFI.xcframework built for this PR.
SwiftPM (host the zip at a stable URL, then use): .binaryTarget(
name: "DashSDKFFI",
url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
checksum: "4412837c554382cc2d071532e473315c0f0d6eb763d0843d8fa05f02324902e2"
)Xcode manual integration:
|
Issue being fixed or feature implemented
Two unchecked integer casts could silently truncate values:
nullifiers.len() as i64in store_nullifiers (overflow on large counts)nullifiers.len() as u16in verify_shielded_nullifiers (truncation above 65535)What was done?
Replaced both with
try_from()that returns proper errors instead of silently truncating.How Has This Been Tested?
cargo check -p drive— compiles cleanlyBreaking Changes
None.
Checklist: