Commit 36fd127
Validate nanoseconds range when unpacking timestamps in the C extension
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>1 parent c6b4a48 commit 36fd127
2 files changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
| 274 | + | |
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
| 279 | + | |
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
284 | 289 | | |
285 | 290 | | |
286 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
| |||
0 commit comments