ElementsProject / ElementsProject/lightning
common: json_to_s64 and json_to_double still accept hex, octal and signs
- Dominant language
- C
- Stars
- 3.1k
- Forks
- 1k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 13
Description
#9150 routed `json_to_u64()` through the new `str_to_u64()`, which accepts strict decimal only. `json_to_s64()` and `json_to_double()` still use `strtoll`/`strtod` with base 0, so they accept hex (`0x...`), octal, and a leading `+`/`-`, none of which are valid JSON numbers. `u64` is now asymmetric with the other two.
Note the `u64` change already altered one case: `"010"` used to parse as 8 (base-0 octal) and now parses as 10. Correct per JSON, but worth being aware of when tightening the others.
No urgency, this has been the parsing behaviour for a long time.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.