isaiah / transit-erlang

transit format for erlang
MIT License
43 stars 12 forks source link

Verbose encoding fails for maps with tagged symbols #19

Closed jlouis closed 10 years ago

jlouis commented 10 years ago

QuickCheck found this counterexample after shrinking:

#{{tagged_value,<<"$">>,<<"phineas">>} => #{'\001' => {tagged_value,<<"$">>,<<"^">>}}}

It appears to be minimal. No investigation as of yet, but it only affects the verbose formatter and we have:

18> transit:write(QE, [{format, json_verbose}]).
<<"{\"~$phineas\":{\"~:\\u0001\":\"~$~^\"}}">>
19> transit:read(v(18), [{format, json_verbose}]).
#{{tagged_value,<<"$">>,<<"phineas">>} => #{'\001' => {tagged_value,<<"$">>,<<"~^">>}}}

Note the string is incorrectly being doubly escaped. This sounds like the same bug found in the normal json marshaler.

jlouis commented 10 years ago

This has been fixed as of late. The verbose encoder now handles these things correctly as well.