fix(drive): guard against max_elements=0 in encrypted notes verification#3204
Conversation
When max_elements=0, the end_index calculation `start_index + limit - 1` would underflow (u64 subtraction). Add an early return error. 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: "1ea492de820aea654f2e58fb319c6691185b37cacba2f7ec8531ee75d04853a1"
)Xcode manual integration:
|
Issue being fixed or feature implemented
When
max_elements=0is passed toverify_shielded_encrypted_notes,limitbecomes 0 andstart_index + limit - 1underflows (u64 wrapping subtraction), producing an incorrect range query.What was done?
Added an early error return when
max_elements == 0. Also simplified the chunk alignment check sincechunk_size > 0is now guaranteed.How Has This Been Tested?
cargo check -p drive— compiles cleanlyBreaking Changes
None.
Checklist: