mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* strftime.c (STRFTIME): return 0 and ERANGE when precision is too
large. [ruby-dev:43284] fixes #4456 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6a288deabc
commit
7bb73a0852
2 changed files with 9 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Mar 3 14:25:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* strftime.c (STRFTIME): return 0 and ERANGE when precision is too
|
||||||
|
large. [ruby-dev:43284] fixes #4456
|
||||||
|
|
||||||
Thu Mar 3 00:46:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
Thu Mar 3 00:46:51 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* addr2line.c (uleb128): cast the value to unsigned long.
|
* addr2line.c (uleb128): cast the value to unsigned long.
|
||||||
|
|
|
@ -237,6 +237,10 @@ 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); \
|
i = rb_strftime_with_timespec(s, endp - s, (fmt), vtm, timev, ts, gmt); \
|
||||||
if (!i) return 0; \
|
if (!i) return 0; \
|
||||||
if (precision > i) {\
|
if (precision > i) {\
|
||||||
|
if (start + maxsize < s + precision) { \
|
||||||
|
errno = ERANGE; \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
memmove(s + precision - i, s, i);\
|
memmove(s + precision - i, s, i);\
|
||||||
memset(s, padding ? padding : ' ', precision - i); \
|
memset(s, padding ? padding : ' ', precision - i); \
|
||||||
s += precision; \
|
s += precision; \
|
||||||
|
|
Loading…
Reference in a new issue