Skip to content

common: json_to_s64 and json_to_double still accept hex, octal and signs #9377

Description

@nGoline

#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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions