Merge in heap overflow patches from upstream

https://www.ruby-lang.org/en/news/2013/11/22/heap-overflow-in-floating-point-parsing-cve-2013-4164/

Merged https://github.com/heroku/ruby/commit/7bfddb643143c5fbdaede646269b2f522e082840 and https://github.com/ruby/ruby/commit/4cd481f031597b7b933af5d1a14a25c19841c0d1 from "upstream"