ugorji / go

idiomatic codec and rpc lib for msgpack, cbor, json, etc. msgpack.org[Go]
MIT License
1.85k stars 295 forks source link

JSON encoder hangs forever with malformed UTF runes #335

Closed shirolimit closed 4 years ago

shirolimit commented 4 years ago

The current version of JSON encoder hangs forever in a tight loop if it stumbles upon malformed UTF rune with size more than 1.

Here is a snippet to reproduce: https://play.golang.org/p/q2T2uWYyOok

I believe that the problem is in this fragment: https://github.com/ugorji/go/blob/master/codec/json.go#L416