Open
Description
System information
Type | Version/Name |
---|---|
Distribution Name | NixOS |
Distribution Version | 20.09 |
Linux Kernel | 5.10.15 |
Architecture | x86_64 |
ZFS Version | 2.0.2-1 |
SPL Version | 2.0.2-1 |
(but this is all fairly irrelevant)
Describe the problem you're observing
The libnvpair_json library code uses numbers for large numbers:
zfs/lib/libnvpair/libnvpair_json.c
Lines 192 to 216 in 5b52516
However, JavaScript represents all numbers as floating point, with a 53 bit mantissa. This means that integers in JSON which are larger than 2^53 are truncated.Some non-JavaScript JSON parsers try to carefully match the semantics of JavaScript and can introduce these mysteries.
See: https://rachelbythebay.com/w/2021/02/03/bits/
Describe how to reproduce the problem
- Create a ZFS Channel Program which emits some large numbers as json
- Consume that JSON via various parsers