1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vsnprintf.c: fix buffer overflow

* vsnprintf.c (MAXEXP, MAXFRACT): calculate depending on constants in
  float.h.
* vsnprintf.c (BSD_vfprintf): limit length for cvt() to get rid of
  buffer overflow.  [ruby-core:57023] [Bug #8864]
* vsnprintf.c (exponent): make expbuf size more precise.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-09-12 11:07:30 +00:00
parent 1472ca9067
commit 88d28fb7cd
3 changed files with 36 additions and 10 deletions

View file

@ -545,7 +545,7 @@ class TestSprintfComb < Test::Unit::TestCase
combination(%w[e E f g G],
[nil, 0, 5, 20],
["", ".", ".0", ".8", ".20", ".200"],
["", ".", ".0", ".8", ".20", ".200", ".9999"],
*FLAGS) {|type, width, precision, sp, hs, pl, mi, zr|
format = "%#{sp}#{hs}#{pl}#{mi}#{zr}#{width}#{precision}#{type}"
define_method("test_format_float(#{format})", assertions_format_float(format))