nlohmann / json

JSON for Modern C++
https://json.nlohmann.me
MIT License
41.25k stars 6.57k forks source link

git ref got interpreted as number #4332

Closed juliandm closed 2 months ago

juliandm commented 2 months ago

Description

i tried to parse the following object (which symbolises a git ref)

'{"ref":"6653406e8512483ea41127ccecac9197afe273fe"}' and it apparently tried to parse the ref as a number and not as string

[json.exception.out_of_range.406] number overflow parsing '6653406e8512483'

I guess it's a very rare case because it worked multiple times before and with this specific string it failed

Reproduction steps

Parse '{"ref":"6653406e8512483ea41127ccecac9197afe273fe"}'

Expected vs. actual results

Expected result is the object with the ref attribute which is a string

Minimal code example

No response

Error messages

[json.exception.out_of_range.406] number overflow parsing '6653406e8512483'

Compiler and operating system

Linux

Library version

1800

Validation

juliandm commented 2 months ago

My code was accidentally trying to parse the ref value although it was just a string.