mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
json: fix json.decode bug for u64 values greater than 2^31 (#11238)
This commit is contained in:
parent
1570e613b5
commit
4fb570522a
@ -33,3 +33,14 @@ fn test_json_decode_works_with_a_dict_of_arrays() {
|
||||
assert res.twins[1].seed == 'dfgdfgdfgd'
|
||||
assert res.twins[1].pubkey == 'skjldskljh45sdf'
|
||||
}
|
||||
|
||||
struct Mount {
|
||||
size u64
|
||||
}
|
||||
|
||||
fn test_decode_u64() ? {
|
||||
data := '{"size": 10737418240}'
|
||||
m := json.decode(Mount, data) ?
|
||||
assert m.size == 10737418240
|
||||
println(m)
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ fn decode_u64(root &C.cJSON) u64 {
|
||||
if isnil(root) {
|
||||
return u64(0)
|
||||
}
|
||||
return u64(root.valueint)
|
||||
return u64(root.valuedouble)
|
||||
}
|
||||
|
||||
fn decode_f32(root &C.cJSON) f32 {
|
||||
|
Loading…
Reference in New Issue
Block a user