Fix corrupt data handling edge cases#116
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis PR adds safer metadata time conversion, tighter decoder bounds and skip validation, IPv6 within/networks handling without an IPv4 subtree, and new benchmark targets for the affected paths. ChangesBug fixes and benchmarks
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/decoder.rs`:
- Around line 713-727: The pointer-handling branch in decoder logic does not
verify the encoded pointer payload when follow_pointers is false, allowing
truncated pointers to be accepted after decode_pointer() clamps them. Update the
TYPE_POINTER path in the decoder to advance past the raw pointer bytes with
skip_bytes(size) in the no-follow case instead of immediately returning Ok(()),
while keeping the existing follow_pointers flow and validate_skip_end() behavior
for the pointer-following path.
In `@src/within.rs`:
- Around line 211-216: The normalization in the IPv6 handling path is zeroing
out low IPv6 addresses, which turns real networks like ::1/128 into ::/128.
Update the conversion logic in the within.rs IPv6 branch (the code that matches
on NetworkKind::V6 and IpAddr::V4, plus the related low-key handling later in
the same function) to reconstruct the IPv6 address from the original
IpInt::V6(ip) value instead of replacing it with zero, so the low bits are
preserved.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: a2071a19-c1e5-49ff-b2d8-f8583fd4ee85
📒 Files selected for processing (11)
CHANGELOG.mdCargo.tomlbenches/metadata.rsbenches/serde_usage.rsbenches/within.rssrc/decoder.rssrc/metadata.rssrc/reader.rssrc/reader_test.rssrc/result.rssrc/within.rs
|
Addressed review feedback with three fixup commits:
Benchmark comparison against fresh
Branch-only benchmarks also ran:
Validation rerun after the fixups:
|
|
Addressed the What changed:
Validation after the fix:
Full benchmark pass against saved
Branch-only benchmark targets newly added on this PR:
No regressions showed up in this pass. |
c25c6f6 to
3a53611
Compare
|
Updated the metadata build-time fix after follow-up discussion and force-pushed the autosquashed branch. Current behavior:
Validation after autosquash:
Benchmark comparison for the affected API against the previous commit:
The earlier full |
3a53611 to
c589a6f
Compare
|
Added the two agreed 0.29.0 breaking cleanups and autosquashed them into the metadata commit. Additional changes:
Validation after autosquash:
Feature validation run before autosquash on the same tree:
Focused previous-commit benchmark comparisons:
|
Summary
within()/networks()for IPv6 databases without an IPv4 subtree, including comments for the non-obvious terminal-node checks.Metadata::build_time()overflow-safe and addMetadata::checked_build_time()for callers that need to detect overflow.Benchmarks
networks_city_testno change,city_subnetimproved about 7.4%, mixed iteration within noise.metadata/build_timebenchmark improved about 21.5%.Validation
cargo fmt --checkcargo testcargo bench --no-runcargo clippy --all-targets -- -D warningscargo test --features mmapcargo test --features simdutf8cargo test --features unsafe-str-decodecargo test --features "mmap simdutf8"cargo test --features "mmap unsafe-str-decode"cargo clippy --all-targets --features mmap -- -D warningscargo clippy --all-targets --features simdutf8 -- -D warningscargo clippy --all-targets --features unsafe-str-decode -- -D warningscargo clippy --all-targets --features "mmap simdutf8" -- -D warningscargo clippy --all-targets --features "mmap unsafe-str-decode" -- -D warningsSummary by CodeRabbit
within()/network iteration for IPv6 databases without an IPv4 search tree, including correct/32handling and improved address normalization.build_timeoverflow-safe and changed it to returnResult<SystemTime, _>for unrepresentable timestamps.within(), and serde decoding micro-cases.