diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-04-18 08:46:18 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-04-18 08:46:18 +0000 |
| commit | 55501974a7ddd1c8371c84bac8089a1bb3a8c7aa (patch) | |
| tree | 12cf55d22b7b78304e8a692c44217e9531a31c02 /string.c | |
| parent | 3b0f857958ab5a04c245b6fb9f2f0b69b6b4eb48 (diff) | |
| download | ruby-55501974a7ddd1c8371c84bac8089a1bb3a8c7aa.tar.gz ruby-55501974a7ddd1c8371c84bac8089a1bb3a8c7aa.tar.xz ruby-55501974a7ddd1c8371c84bac8089a1bb3a8c7aa.zip | |
* re.c (rb_reg_expr_str): should treat backslash specially in
escaping.
* io.c: complete off_t handling; missing argument for
fptr_finalize(); polished rb_scan_args call.
* dir.c: wrap multi-statment macro by do { } while (0)
* eval.c, numeric,c, sprintf.c, util.c: ditto.
* bignum.c (rb_big_eq): check `y == x' if y is neither Fixnum,
Bignum, nor Float.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
| -rw-r--r-- | string.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -58,6 +58,10 @@ str_new(klass, ptr, len) { VALUE str = rb_obj_alloc(klass); + if (len < 0) { + rb_raise(rb_eArgError, "negative string size (or size too big)"); + } + RSTRING(str)->len = len; RSTRING(str)->aux.capa = len; RSTRING(str)->ptr = ALLOC_N(char,len+1); @@ -460,8 +464,8 @@ void rb_str_modify(str) VALUE str; { - if (str_independent(str)) return; - str_make_independent(str); + if (!str_independent(str)) + str_make_independent(str); } VALUE |
