Skip to content
Commit efcd4879 authored by Jo-Philipp Wich's avatar Jo-Philipp Wich
Browse files

luci-lib-jsonc: improve handling of integral numeric values



Properly deal with integral numeric values exceeding the int32_t range
by replacing the cast logic with more fine grained checks:

 - Lua numbers which are integers in the first place are directly converted
   to JSON integers

 - Finite double Lua numbers which are integral are converted to JSON
   integer values

 - All other numeric values are converted to JSON doubles

This should bring the handling of large integral value in line with the
documented behavior of turning non-fractional Lua numbers into JSON
integers.

Fixes: #6647
Signed-off-by: default avatarJo-Philipp Wich <jo@mein.io>
parent 425bcfcb
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment