diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-28 23:31:44 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-28 23:31:44 +0000 |
commit | 6b47d60e1681d643710ef0c1462539cfdcea9877 (patch) | |
tree | d560b96db75e2177b7b66d80d1d2dba0d063e399 /strftime.c | |
parent | aed90c7cae00669436c001cdc747bb0ed93c1e31 (diff) |
* strftime.c (STRFTIME): return 0 and ERANGE when precision is too
large. [ruby-dev:43284] fixes #4456
based on r31011.
* test/test_time.rb (TestTime#test_huge_precision): test for #4456.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'strftime.c')
-rw-r--r-- | strftime.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/strftime.c b/strftime.c index 2b98e29148..3c32d09d99 100644 --- a/strftime.c +++ b/strftime.c @@ -309,6 +309,7 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str i = rb_strftime_with_timespec(s, endp - s, fmt, vtm, timev, ts, gmt); \ if (!i) return 0; \ if (precision > i) {\ + NEEDS(precision); \ memmove(s + precision - i, s, i);\ memset(s, padding ? padding : ' ', precision - i); \ s += precision; \ |