davisp / jiffy

JSON NIFs for Erlang
Other
869 stars 319 forks source link

return_trailer and bignum handling broken #206

Closed aboroska closed 3 years ago

aboroska commented 3 years ago

Version: 1.0.6 on Erlang/OTP 22

The following works as expected:

> jiffy:decode(<<"{\"amount\":-50000000000000000000}">>, [return_maps]).
#{<<"amount">> => -50000000000000000000}

With return_trailer option though the value gets wrapped in{bignum, Val}

> jiffy:decode(<<"{\"amount\":-50000000000000000000}{}">>, [return_maps, return_trailer]).
{has_trailer,#{<<"amount">> =>
               {bignum,<<"-50000000000000000000">>}},
         <<"{}">>}

Is this some oversight in the trailer processing part?

davisp commented 3 years ago

Looks like a bug yeah. I'll try and find time tomorrow to look at it.

davisp commented 3 years ago

Bug is fixed in 1.0.7 1.0.8. Pushed on version and then thought slightly harder. Thanks for the report!