summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--string.c9
-rw-r--r--version.h2
3 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 040f925349..39dca837d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Dec 6 22:28:41 2010 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * string.c (rb_str_concat): partially reverts r30040 because
+ it unpexpectedly changes the behavior of String#<<.
+
Fri Nov 5 00:14:15 2010 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/fiddle/extconf.rb: fixing ffi library location on windows.
diff --git a/string.c b/string.c
index bee5fb100b..cdb919939b 100644
--- a/string.c
+++ b/string.c
@@ -1998,14 +1998,23 @@ rb_str_concat(VALUE str1, VALUE str2)
unsigned int lc;
if (FIXNUM_P(str2)) {
+ if ((int)str2 < 0)
+ rb_raise(rb_eRangeError, "negative argument");
lc = FIX2UINT(str2);
}
else if (TYPE(str2) == T_BIGNUM) {
+ if (!RBIGNUM_SIGN(str2))
+ rb_raise(rb_eRangeError, "negative argument");
lc = NUM2UINT(str2);
}
else {
return rb_str_append(str1, str2);
}
+#if SIZEOF_INT < SIZEOF_VALUE
+ if ((VALUE)lc > UINT_MAX) {
+ rb_raise(rb_eRangeError, "%"PRIuVALUE" out of char range", lc);
+ }
+#endif
{
rb_encoding *enc = STR_ENC_GET(str1);
long pos = RSTRING_LEN(str1);
diff --git a/version.h b/version.h
index 6ee4d69c66..ea30e3ec43 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 90
+#define RUBY_PATCHLEVEL 91
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1