diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | io.c | 4 | ||||
-rw-r--r-- | marshal.c | 4 | ||||
-rw-r--r-- | parse.y | 20 | ||||
-rw-r--r-- | version.h | 6 |
5 files changed, 24 insertions, 19 deletions
@@ -1,3 +1,12 @@ +Wed Sep 12 15:19:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * io.c (rb_io_s_sysopen): should not use alloca for unknowen size + input. [ruby-dev:31775] + + * parse.y (rb_id2str): ditto. + + * marshal.c (w_float): use snprintf instead of sprintf. + Tue Sep 11 17:28:00 2007 Akinori MUSHA <knu@iDaemons.org> * lib/tempfile.rb (Tempfile::make_tmpname): Allow to specify a @@ -3455,8 +3455,8 @@ rb_io_s_sysopen(int argc, VALUE *argv) if (NIL_P(perm)) fmode = 0666; else fmode = NUM2INT(perm); - path = ALLOCA_N(char, strlen(RSTRING_PTR(fname))+1); - strcpy(path, RSTRING_PTR(fname)); + RB_GC_GUARD(fname) = rb_str_new4(fname); + path = RSTRING_PTR(fname); fd = rb_sysopen(path, flags, fmode); return INT2NUM(fd); } @@ -309,7 +309,7 @@ load_mantissa(double d, const char *buf, int len) static void w_float(double d, struct dump_arg *arg) { - char buf[100]; + char buf[FLOAT_DIG + (DECIMAL_MANT + 7) / 8 + 10]; if (isinf(d)) { if (d < 0) strcpy(buf, "-inf"); @@ -326,7 +326,7 @@ w_float(double d, struct dump_arg *arg) int len; /* xxx: should not use system's sprintf(3) */ - sprintf(buf, "%.*g", FLOAT_DIG, d); + snprintf(buf, sizeof(buf), "%.*g", FLOAT_DIG, d); len = strlen(buf); w_bytes(buf, len + save_mantissa(d, buf + len), arg); return; @@ -8553,21 +8553,17 @@ rb_id2str(ID id) if (is_attrset_id(id)) { ID id2 = (id & ~ID_SCOPE_MASK) | ID_LOCAL; + VALUE str; - again: - name = rb_id2name(id2); - if (name) { - char *buf = ALLOCA_N(char, strlen(name)+2); - - strcpy(buf, name); - strcat(buf, "="); - rb_intern(buf); - return rb_id2str(id); - } - if (is_local_id(id2)) { + while (!(str = rb_id2str(id2))) { + if (!is_local_id(id2)) return 0; id2 = (id & ~ID_SCOPE_MASK) | ID_CONST; - goto again; } + str = rb_str_dup(str); + rb_str_cat(buf, "=", 1); + rb_intern_str(str); + if (st_lookup(global_symbols.id_str, id, &data)) + return (VALUE)data; } return 0; } @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2007-09-10" +#define RUBY_RELEASE_DATE "2007-09-12" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20070910 +#define RUBY_RELEASE_CODE 20070912 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 9 -#define RUBY_RELEASE_DAY 10 +#define RUBY_RELEASE_DAY 12 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; |