diff --git a/ChangeLog b/ChangeLog index d4e2f18a07..c2b1929f74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ Sat Oct 2 00:42:20 2004 Yukihiro Matsumoto + * string.c (rb_str_sum): should use bignums when bits is greater + than or equals to sizeof(long)*CHAR_BITS. [ruby-dev:24395] + + * eval.c (specific_eval): defer pointer retrieval to prevent + unsafe sourcefile string modification. [ruby-dev:24382] + * string.c (rb_str_sum): wrong cast caused wrong result. [ruby-dev:24385] diff --git a/eval.c b/eval.c index 76726f012f..5b4cfe3b03 100644 --- a/eval.c +++ b/eval.c @@ -6322,10 +6322,10 @@ specific_eval(argc, argv, klass, self) rb_id2name(ruby_frame->last_func), rb_id2name(ruby_frame->last_func)); } + if (argc > 2) line = NUM2INT(argv[2]); if (argc > 1) { file = StringValuePtr(argv[1]); } - if (argc > 2) line = NUM2INT(argv[2]); } return eval_under(klass, self, argv[0], file, line); } diff --git a/string.c b/string.c index c6e43fd212..ac87b8d68f 100644 --- a/string.c +++ b/string.c @@ -4416,7 +4416,7 @@ rb_str_sum(argc, argv, str) ptr = p = RSTRING(str)->ptr; len = RSTRING(str)->len; pend = p + len; - if (bits > sizeof(long)*CHAR_BIT) { + if (bits >= sizeof(long)*CHAR_BIT) { VALUE sum = INT2FIX(0); while (p < pend) {