From c8a403ebc47759d2a18ac381e1af93c48248ac58 Mon Sep 17 00:00:00 2001 From: tadf Date: Sat, 13 Aug 2011 00:15:50 +0000 Subject: [PATCH] * ext/date/date_core.c (date_strftime_alloc): followed the change of r32885. * NEWS: followed the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ NEWS | 6 +++--- ext/date/date_core.c | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e314109c2d..558fe09db2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Aug 13 09:15:16 2011 Tadayoshi Funaba + + * ext/date/date_core.c (date_strftime_alloc): followed the change + of r32885. + * NEWS: followed the above change. + Sat Aug 13 08:49:05 2011 Tadayoshi Funaba * ext/date/date_core.c: [ruby-core:38855]. diff --git a/NEWS b/NEWS index 7aea2bff40..3cab61b14b 100644 --- a/NEWS +++ b/NEWS @@ -163,10 +163,10 @@ with all sufficient information, see the ChangeLog file. * A method strftime cannot produce huge output (same as Time's one). - * Even though Date/DateTime can handle far dates, the following gives - an empty string: + * Even though Date/DateTime can handle far dates, the following causes + an exception. - DateTime.new(1<<10000).strftime('%Y') #=> "" + DateTime.new(1<<10000).strftime('%Y') # Errno::ERANGE * Changed the format of inspect. * Changed the format of marshal (but, can load old dumps). diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 6474074028..c78eda47a9 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -6721,8 +6721,12 @@ date_strftime_alloc(char **buf, const char *format, * if the buffer is 1024 times bigger than the length of the * format string, it's not failing for lack of room. */ - if (len > 0 || size >= 1024 * flen) break; + if (len > 0) break; xfree(*buf); + if (size >= 1024 * flen) { + rb_sys_fail(format); + break; + } } return len; }