[#20036] Re: Roundoff problem with Float and Marshal — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

16 messages 2003/04/18
[#20045] Re: Roundoff problem with Float and Marshal — nobu.nakada@... 2003/04/20

なかだです。

[#20063] Re: Roundoff problem with Float and Marshal — matz@... (Yukihiro Matsumoto) 2003/04/22

まつもと ゆきひろです

[#20097] jcode.rb — akira yamada / やまだあきら <akira@...>

25 messages 2003/04/26
[#20098] Re: jcode.rb — matz@... (Yukihiro Matsumoto) 2003/04/27

まつもと ゆきひろです

[#20105] Re: jcode.rb — WATANABE Hirofumi <eban@...> 2003/04/28

わたなべです。

[#20108] Re: jcode.rb — matz@... (Yukihiro Matsumoto) 2003/04/28

まつもと ゆきひろです

[ruby-dev:20007] SEGV on File.stat(String.allocate)

From: nobu.nakada@...
Date: 2003-04-11 05:18:24 UTC
List: ruby-dev #20007
なかだです。

native windows版で File.stat(String.allocate) がSEGVします。最
初rb_w32_stat()を修正したんですが、file.cをみると、DJGPPだけで
すがrb_stat()ではptrがNULLの場合を避けるようになってます。一方
rb_file_s_stat()ではそういうことはしていないので、djgppでも同じ
くSEGVになりそうな気がします。

これはfile.cのほうを直すべきでしょうか。またその場合、errnoは何
が適当でしょうか。

# EFAULTがない環境はない?

とりあえず作ったのでrb_w32_stat()へのパッチ。


Index: win32/win32.c
===================================================================
RCS file: /pub/cvs/ruby/src/ruby/win32/win32.c,v
retrieving revision 1.83
diff -u -2 -p -r1.83 win32.c
--- win32/win32.c	28 Feb 2003 15:01:56 -0000	1.83
+++ win32/win32.c	11 Apr 2003 04:44:38 -0000
@@ -2725,10 +2725,13 @@ rb_w32_stat(const char *path, struct sta
 {
     const char *p;
-    char *buf1 = ALLOCA_N(char, strlen(path) + 2);
-    char *buf2 = ALLOCA_N(char, MAXPATHLEN);
-    char *s;
+    char *buf1, *buf2, *s;
     int len;
     int ret;
 
+    if (!path) {
+	errno = EFAULT;
+	return -1;
+    }
+    buf1 = ALLOCA_N(char, strlen(path) + 2);
     for (p = path, s = buf1; *p; p++, s++) {
 	if (*p == '/')
@@ -2750,4 +2753,5 @@ rb_w32_stat(const char *path, struct sta
     } else if (*p == '\\' || *p == ':')
 	strcat(buf1, ".");
+    buf2 = ALLOCA_N(char, MAXPATHLEN);
     if (_fullpath(buf2, buf1, MAXPATHLEN)) {
 	ret = stat(buf2, st);



-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread

Prev Next