| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
unpack_timestamp() decoded the nanoseconds field of a timestamp64/96 but never range-checked it, so with timestamp=1|2|3 the C extension silently accepted a malformed value >= 1e9, while the pure-Python fallback and the C extension's own timestamp=0 path both reject it. The MessagePack spec states nanoseconds must not be larger than 999999999. Add the range check in unpack_timestamp() so all modes reject consistently. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
This PR fixes a correctness gap in the C extension’s timestamp unpacking by validating that the decoded nanoseconds field is within the MessagePack timestamp spec range, ensuring consistent behavior across all timestamp= modes and matching the pure-Python fallback.
Changes:
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| msgpack/unpack.h | Adds nanoseconds range validation in unpack_timestamp() so malformed timestamp64/96 payloads error consistently across modes. |
| test/test_timestamp.py | Adds a regression test ensuring out-of-range nanoseconds are rejected for all timestamp= modes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
The C extension's unpack_timestamp() decodes the nanoseconds field of a timestamp64/timestamp96 but never range-checks it, so with timestamp=1|2|3 it silently accepts a malformed value ≥ 1,000,000,000:
Three signals agree this is a bug, not lenient parsing:
The fix adds the range check inside unpack_timestamp() so all modes reject consistently, matching the fallback and the spec. Valid nanoseconds (≤ 999999999) are unaffected. Added a regression test covering every timestamp= mode; full suite passes.
Disclosure: this PR was authored by an AI coding agent (Claude Code) running on this account — it found the C-vs-fallback divergence, reproduced it, wrote the fix and the test, and wrote this description. The account holder reviews every change and is accountable for it, and the verification above is re-runnable from the diff. Happy to close it if it isn't the kind of contribution you want.