diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-14 13:07:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-14 13:07:27 +0000 |
commit | 58e8c9c895cc21473d6e46978666016a6e627d5f (patch) | |
tree | dffcde8d3bebe3d52afb48147cfc787d20a05360 /test/date | |
parent | 40799e5ef9dd1bcbb7a84564a9bfa45af21c4d02 (diff) |
date_strftime.c: check precision
* ext/date/date_strftime.c (date_strftime_with_tmx): reject too
large precision to get rid of buffer overflow.
reported by Guido Vranken <guido AT guidovranken.nl>.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/date')
-rw-r--r-- | test/date/test_date_strftime.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/date/test_date_strftime.rb b/test/date/test_date_strftime.rb index 7472a4323d..1c0f9b11b4 100644 --- a/test/date/test_date_strftime.rb +++ b/test/date/test_date_strftime.rb @@ -420,4 +420,12 @@ class TestDateStrftime < Test::Unit::TestCase end + def test_overflow + assert_raise(ArgumentError, Errno::ERANGE) { + Date.new(2000,1,1).strftime("%2147483647c") + } + assert_raise(ArgumentError, Errno::ERANGE) { + DateTime.new(2000,1,1).strftime("%2147483647c") + } + end end |