brianmario / yajl-ruby

A streaming JSON parsing and encoding library for Ruby (C bindings to yajl)
http://rdoc.info/projects/brianmario/yajl-ruby
MIT License
1.48k stars 169 forks source link

Fix potential bad read #178

Closed brianmario closed 6 years ago

brianmario commented 6 years ago

When decoding a string with escape sequences sure we need to make sure we don't advance our end pointer until we've checked we have enough buffer left to parse, as well as have peeked ahead to see that a unicode escape is approaching.

Thanks @kivikakk for helping me track down the actual bug here! (Previous attempt here)

This fix should be applied upstream on yajl itself as well, but I'm starting here since that's where the original issue was reported and we have a patched yajl embedded anyway.

Fixes #176