2 files changed,
+22
−1
internal/provisioner/floor_linux.go
+1 −1
internal/provisioner/floor_linux_test.go
+21 −0
| index 8892c32..bcf9bb9 100644 |
| --- a/internal/provisioner/floor_linux.go |
| +++ b/internal/provisioner/floor_linux.go |
| @@ -56,7 +56,7 @@ func canonicalJSON(v any) ([]byte, error) { |
| return nil, ErrRefused |
| } |
| j := jsontext.Value(b) |
| - if j.Canonicalize() != nil { |
| + if j.Canonicalize(jsontext.CanonicalizeRawInts(false)) != nil { |
| return nil, ErrRefused |
| } |
| return j, nil |
| index 60134fa..c0c61e9 100644 |
| --- a/internal/provisioner/floor_linux_test.go |
| +++ b/internal/provisioner/floor_linux_test.go |
| @@ -149,3 +149,24 @@ func TestFloorScanSeesDurableRecordBeforeMarkerUpdate(t *testing.T) { |
| t.Fatal("matching interrupted marker did not resume", e) |
| } |
| } |
| + |
| +func TestCanonicalMetadataPreservesTypedIntegerPrecision(t *testing.T) { |
| + value := struct { |
| + Signed int64 `json:"signed"` |
| + Unsigned uint64 `json:"unsigned"` |
| + }{9223372036854775807, 18446744073709551615} |
| + raw, e := canonicalJSON(value) |
| + if e != nil { |
| + t.Fatal(e) |
| + } |
| + if string(raw) != `{"signed":9223372036854775807,"unsigned":18446744073709551615}` { |
| + t.Fatal("integer precision lost") |
| + } |
| + var decoded struct { |
| + Signed int64 `json:"signed"` |
| + Unsigned uint64 `json:"unsigned"` |
| + } |
| + if closedJSON(raw, &decoded) != nil || decoded != value { |
| + t.Fatal("typed integer did not round trip") |
| + } |
| +} |