summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog19
-rw-r--r--eval.c21
-rw-r--r--ext/Win32API/Win32API.c11
-rw-r--r--ext/socket/socket.c6
-rw-r--r--node.h1
-rw-r--r--parse.y13
-rw-r--r--regex.c66
-rw-r--r--string.c1
-rw-r--r--version.h4
9 files changed, 128 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 08061b4571..77168b5081 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+Wed Mar 8 02:08:43 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y: escape expansion too early.
+
+ * regex.c (re_compile_pattern): support \cX et al.
+
+Mon Mar 6 12:28:37 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c (ip_addrsetup): should check length of hostname.
+
+ * ext/socket/socket.c (ip_addrsetup): check newline at the end of
+ hostname. These fixes suggested by Muvaw Pnazte <bugathlon@yahoo.com>.
+
+Sun Mar 5 20:35:45 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_initialize): should call
+ LoadLibrary() everytime and should assign the hdll to Win32API
+ object(protect the hdll from GC).
+
Sat Feb 26 22:39:31 2000 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
* Fix String#* with huge string.
diff --git a/eval.c b/eval.c
index 6ac4d46e60..e2662c1595 100644
--- a/eval.c
+++ b/eval.c
@@ -4170,6 +4170,27 @@ rb_funcall3(recv, mid, argc, argv)
return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 0);
}
+VALUE
+rb_call_super(argc, argv)
+ int argc;
+ VALUE *argv;
+{
+ VALUE result;
+
+ if (ruby_frame->last_class == 0) {
+ rb_raise(rb_eNameError, "superclass method `%s' must be enabled by rb_enable_super()",
+ rb_id2name(ruby_frame->last_func));
+ }
+
+ PUSH_ITER(ruby_iter->iter?ITER_PRE:ITER_NOT);
+ result = rb_call(RCLASS(ruby_frame->last_class)->super,
+ ruby_frame->self, ruby_frame->last_func,
+ argc, argv, 3);
+ POP_ITER();
+
+ return result;
+}
+
static VALUE
backtrace(lev)
int lev;
diff --git a/ext/Win32API/Win32API.c b/ext/Win32API/Win32API.c
index 38268d0474..433d13abeb 100644
--- a/ext/Win32API/Win32API.c
+++ b/ext/Win32API/Win32API.c
@@ -52,13 +52,10 @@ Win32API_initialize(self, dllname, proc, import, export)
int len;
int ex;
- hdll = GetModuleHandle(RSTRING(dllname)->ptr);
- if (!hdll) {
- hdll = LoadLibrary(RSTRING(dllname)->ptr);
- if (!hdll)
- rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
- Data_Wrap_Struct(self, 0, Win32API_FreeLibrary, hdll);
- }
+ hdll = LoadLibrary(RSTRING(dllname)->ptr);
+ if (!hdll)
+ rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
+ rb_iv_set(self, "__hdll__", Data_Wrap_Struct(self, 0, Win32API_FreeLibrary, hdll));
hproc = GetProcAddress(hdll, RSTRING(proc)->ptr);
if (!hproc) {
str = rb_str_new3(proc);
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 95b2214afb..43bde950f4 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -522,6 +522,9 @@ ip_addrsetup(host, port)
else if (name[0] == '<' && strcmp(name, "<broadcast>") == 0) {
mkinetaddr(INADDR_BROADCAST, hbuf, sizeof(hbuf));
}
+ else if (strlen(name) > sizeof(hbuf)-1) {
+ rb_raise(rb_eSocket, "hostname too long (%d)", strlen(name));
+ }
else {
strcpy(hbuf, name);
}
@@ -543,6 +546,9 @@ ip_addrsetup(host, port)
hints.ai_socktype = SOCK_DGRAM;
error = getaddrinfo(hostp, portp, &hints, &res);
if (error) {
+ if (hostp && hostp[strlen(hostp)-1] == '\n') {
+ rb_raise(rb_eSocket, "newline at the end of hostname");
+ }
rb_raise(rb_eSocket, "%s", gai_strerror(error));
}
diff --git a/node.h b/node.h
index 358a27003d..13e6aa261e 100644
--- a/node.h
+++ b/node.h
@@ -315,7 +315,6 @@ typedef struct RNode {
#define NEW_POSTEXE() rb_node_newnode(NODE_POSTEXE,0,0,0)
NODE *rb_node_newnode();
-VALUE rb_method_booundp();
#define NOEX_PUBLIC 0
#define NOEX_UNDEF 1
diff --git a/parse.y b/parse.y
index 88c738b906..4b3e4c7729 100644
--- a/parse.y
+++ b/parse.y
@@ -3422,9 +3422,16 @@ rb_str_extend(list, term)
tokadd(c);
goto loop_again;
case '\\':
- c = read_escape();
- tokadd(c);
- goto loop_again;
+ c = nextc();
+ if (c == -1) return (NODE*)-1;
+ if (c == term) {
+ tokadd(c);
+ }
+ else {
+ tokadd('\\');
+ tokadd(c);
+ }
+ break;
case '{':
if (brace != -1) nest++;
case '\"':
diff --git a/regex.c b/regex.c
index c273b29e59..c5e5b38d78 100644
--- a/regex.c
+++ b/regex.c
@@ -1048,7 +1048,7 @@ calculate_must_string(start, end)
return must;
}
-static int
+static unsigned int
read_backslash(c)
int c;
{
@@ -1080,6 +1080,47 @@ read_backslash(c)
return c;
}
+static unsigned int
+read_special(p, pend, pp)
+ const char *p, *pend, **pp;
+{
+ int c;
+
+ PATFETCH_RAW(c);
+ switch (c) {
+ case 'M':
+ PATFETCH_RAW(c);
+ if (c != '-') return -1;
+ PATFETCH_RAW(c);
+ *pp = p;
+ if (c == '\\') {
+ return read_special(p, pend, pp) | 0x80;
+ }
+ else if (c == -1) return ~0;
+ else {
+ return ((c & 0xff) | 0x80);
+ }
+
+ case 'C':
+ PATFETCH_RAW(c);
+ if (c != '-') return ~0;
+ case 'c':
+ PATFETCH_RAW(c);
+ *pp = p;
+ if (c == '\\') {
+ c = read_special(p, pend, pp);
+ }
+ else if (c == '?') return 0177;
+ else if (c == -1) return ~0;
+ return c & 0x9f;
+ default:
+ return read_backslash(c);
+ }
+
+ end_of_pattern:
+ return ~0;
+}
+
/* re_compile_pattern takes a regular-expression string
and converts it into a buffer full of byte commands for matching.
@@ -1451,6 +1492,16 @@ re_compile_pattern(pattern, size, bufp)
had_num_literal = 1;
break;
+ case 'M':
+ case 'C':
+ case 'c':
+ p0 = --p;
+ c = read_special(p, pend, &p0);
+ if (c > 255) goto invalid_escape;
+ p = p0;
+ had_num_literal = 1;
+ break;
+
default:
c = read_backslash(c);
if (ismbchar(c)) {
@@ -2137,6 +2188,16 @@ re_compile_pattern(pattern, size, bufp)
BUFPUSH(c1);
break;
+ case 'M':
+ case 'C':
+ case 'c':
+ p0 = --p;
+ c = read_special(p, pend, &p0);
+ if (c > 255) goto invalid_escape;
+ p = p0;
+ had_num_literal = 1;
+ goto numeric_char;
+
default:
c = read_backslash(c);
goto normal_char;
@@ -2299,6 +2360,9 @@ re_compile_pattern(pattern, size, bufp)
nested_meta:
FREE_AND_RETURN(stackb, "nested *?+ in regexp");
+
+ invalid_escape:
+ FREE_AND_RETURN(stackb, "Invalid escape character syntax");
}
void
diff --git a/string.c b/string.c
index 66eee2a65f..325c5b515f 100644
--- a/string.c
+++ b/string.c
@@ -262,6 +262,7 @@ rb_str_times(str, times)
long i, len;
len = NUM2LONG(times);
+ if (len == 0) return rb_str_new(0,0);
if (len < 0) {
rb_raise(rb_eArgError, "negative argument");
}
diff --git a/version.h b/version.h
index 972bd28489..ef834eefeb 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.4.4"
-#define RUBY_RELEASE_DATE "2000-03-02"
+#define RUBY_RELEASE_DATE "2000-03-08"
#define RUBY_VERSION_CODE 144
-#define RUBY_RELEASE_CODE 20000302
+#define RUBY_RELEASE_CODE 20000308