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 | 57f3481fc2b3c03484373ef96463ad7f3ea6cabb (patch) | |
tree | dffcde8d3bebe3d52afb48147cfc787d20a05360 /test/date | |
parent | 98ec4125569e9b33cbb0d891c9098eabebbfb995 (diff) | |
download | ruby-57f3481fc2b3c03484373ef96463ad7f3ea6cabb.tar.gz |
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 |