mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 17:14:01 +02:00
* 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
This commit is contained in:
parent
aed90c7cae
commit
6b47d60e16
4 changed files with 16 additions and 1 deletions
|
@ -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; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue