* eval.c (rb_mod_modfunc): should follow NODE_ZSUPER link; based

on Guy Decoux's patch in [ruby-talk:25478].

* string.c (rb_str_succ): there was buffer overrun.

* parse.y (str_extend): term can be any character.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-11-19 14:42:45 +00:00
Родитель df96f994f1
Коммит 04f27f5e8d
6 изменённых файлов: 36 добавлений и 11 удалений

Просмотреть файл

@ -1,3 +1,16 @@
Mon Nov 19 17:58:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_mod_modfunc): should follow NODE_ZSUPER link; based
on Guy Decoux's patch in [ruby-talk:25478].
Mon Nov 19 16:09:33 2001 Tanaka Akira <akr@m17n.org>
* string.c (rb_str_succ): there was buffer overrun.
Mon Nov 19 14:14:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (str_extend): term can be any character.
Mon Nov 19 04:58:42 2001 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/cgi.rb (header): support for Apache. thanks to

Просмотреть файл

@ -860,8 +860,10 @@ rb_ary_to_s(ary)
VALUE str, sep;
if (RARRAY(ary)->len == 0) return rb_str_new(0, 0);
if (!NIL_P(rb_output_fs)) sep = rb_output_fs;
else sep = rb_default_rs;
sep = rb_output_fs;
#if 1
if (NIL_P(rb_output_fs)) sep = rb_default_rs; /* newline */
#endif
str = rb_ary_join(ary, sep);
return str;
}

14
eval.c
Просмотреть файл

@ -5679,10 +5679,18 @@ rb_mod_modfunc(argc, argv, module)
set_method_visibility(module, argc, argv, NOEX_PRIVATE);
for (i=0; i<argc; i++) {
VALUE m = module;
id = rb_to_id(argv[i]);
body = search_method(module, id, 0);
if (body == 0 || body->nd_body == 0) {
rb_bug("undefined method `%s'; can't happen", rb_id2name(id));
for (;;) {
body = search_method(m, id, &m);
if (body == 0 || body->nd_body == 0) {
rb_bug("undefined method `%s'; can't happen", rb_id2name(id));
}
if (nd_type(body->nd_body) != NODE_ZSUPER) {
break; /* normal case: need not to follow 'super' link */
}
m = RCLASS(m)->super;
}
rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC);
rb_clear_cache_by_id(id);

5
gc.c
Просмотреть файл

@ -20,6 +20,11 @@
#include "re.h"
#include <stdio.h>
#include <setjmp.h>
#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>

Просмотреть файл

@ -4028,19 +4028,16 @@ str_extend(list, term)
break;
case '{':
if (brace != -1) nest++;
case '\"':
case '/':
case '`':
default:
if (c == term) {
pushback(c);
list_append(list, NEW_STR(rb_str_new2("#")));
rb_warning("bad substitution in string");
rb_warn("bad substitution in string");
tokfix();
list_append(list, NEW_STR(rb_str_new(tok(), toklen())));
newtok();
return list;
}
default:
tokadd(c);
break;
}

Просмотреть файл

@ -1018,7 +1018,7 @@ rb_str_succ(orig)
}
}
if (s < sbeg) {
REALLOC_N(RSTRING(str)->ptr, char, RSTRING(str)->len + 1);
REALLOC_N(RSTRING(str)->ptr, char, RSTRING(str)->len + 2);
s = RSTRING(str)->ptr + n;
memmove(s+1, s, RSTRING(str)->len - n);
*s = c;