Commit 2783e60
authored
fix(acl): preserve Number::Int on serde_json round-trip (#15481)
* fix(acl): preserve Number::Int on serde_json round-trip
From<serde_json::Value> for Value was checking as_f64() first, which
succeeds for any integer that fits in an f64, causing all integer values
to be silently coerced to Number::Float on deserialization.
Fix the check order to prefer as_i64() first, then as_u64() (falling
back to Float for values above i64::MAX to avoid silent wrapping), and
only using as_f64() for genuine floating-point numbers.
Fixes #15480
* fix(acl): preserve Number::Int on serde_json round-trip
From<serde_json::Value> for Value was checking as_f64() first, which
succeeds for any integer that fits in an f64, causing all integer values
to be silently coerced to Number::Float on deserialization.
Fix the check order to prefer as_i64() first, then as_u64() (cast to
i64, wrapping for values above i64::MAX), and only using as_f64() for
genuine floating-point numbers.
Fixes #154801 parent f092d10 commit 2783e60
2 files changed
Lines changed: 12 additions & 5 deletions
File tree
- .changes
- crates/tauri-utils/src/acl
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
90 | 94 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
0 commit comments