fix(native): Don't fail deserializing JS numbers above u64/i64 range#11034
Conversation
|
Claude finished @ovr's task in 38s —— View job Code ReviewThe change is small and correct. JS numbers are all f64, so an integer-valued magnitude above Findings
Nit (non-blocking): The chain LGTM. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11034 +/- ##
===========================================
+ Coverage 58.44% 78.78% +20.34%
===========================================
Files 216 471 +255
Lines 17248 94509 +77261
Branches 3520 3520
===========================================
+ Hits 10080 74459 +64379
- Misses 6660 19542 +12882
Partials 508 508
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A JS number like 5.18e44 is integer-valued (fract() is always 0.0 for |value| >= 2^52, since an f64 has no fractional bits at that magnitude), so it skipped the float path, then failed to fit in any u64/i64 branch and hit "Unsupported number type for deserialization". Fall back to visit_f64 for such values instead of erroring. The value already arrived as an f64, so nothing is lost beyond JS's own precision.
7e4882a to
add4d17
Compare
|
Claude finished @ovr's task in 29s —— View job Code ReviewVerdict: LGTM — 0 high, 0 medium, 1 low (pre-existing, not introduced by this PR). Details
Correctness: ✅ The reasoning in the PR description is right — for Comment quality: The inline comment is clear about the why — good. 👍 Behavioral change worth flagging: Downstream visitors that explicitly asked for an integer ( Performance / security: No concerns. Pure deserialization path. Tests: No tests exist for Low (pre-existing, not introduced): The unsigned chain at lines 79–93 uses |
A JS number like 5.18e44 is integer-valued (fract() is always 0.0 for |value| >= 2^52, since an f64 has no fractional bits at that magnitude), so it skipped the float path, then failed to fit in any u64/i64 branch and hit "Unsupported number type for deserialization".
Fall back to visit_f64 for such values instead of erroring. The value already arrived as an f64, so nothing is lost beyond JS's own precision.