numeric.c: fix edge case
* numeric.c (rb_fix2str): fix edge case, accidentally generated wrong Fixnum from LONG_MIN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8b4448e2e1
commit
05d916415f
@ -1,3 +1,8 @@
|
|||||||
|
Sun Mar 13 09:15:45 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* numeric.c (rb_fix2str): fix edge case, accidentally generated
|
||||||
|
wrong Fixnum from LONG_MIN.
|
||||||
|
|
||||||
Sat Mar 12 09:50:27 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Mar 12 09:50:27 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* vm_eval.c (rb_f_catch): [DOC] fix malformed RDoc syntax, "+...+"
|
* vm_eval.c (rb_f_catch): [DOC] fix malformed RDoc syntax, "+...+"
|
||||||
|
10
numeric.c
10
numeric.c
@ -2905,7 +2905,15 @@ rb_fix2str(VALUE x, int base)
|
|||||||
return rb_usascii_str_new2("0");
|
return rb_usascii_str_new2("0");
|
||||||
}
|
}
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
val = -val;
|
if (val == LONG_MIN) {
|
||||||
|
int last = ((int)((val = LONG_MAX) % base) + 1);
|
||||||
|
*--b = ruby_digitmap[last % base];
|
||||||
|
val /= base;
|
||||||
|
val += last == base; /* carry */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
val = -val;
|
||||||
|
}
|
||||||
neg = 1;
|
neg = 1;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user