aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--file.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index fe3ae3364a..336addfc0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jan 27 18:34:58 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * file.c (w32_io_info): get rid of too huge alloca().
+ [Bug #4313] [ruby-core:34830]
+
Thu Jan 27 18:19:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* win32/win32.c (wstati64): get rid of too huge alloca().
diff --git a/file.c b/file.c
index 2bc3e4b050..00a2a0c7ee 100644
--- a/file.c
+++ b/file.c
@@ -835,15 +835,18 @@ w32_io_info(VALUE *file, BY_HANDLE_FILE_INFORMATION *st)
VALUE tmp;
WCHAR *ptr;
int len;
+ VALUE v;
+
FilePathValue(*file);
tmp = rb_str_encode_ospath(*file);
len = MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, NULL, 0);
- ptr = ALLOCA_N(WCHAR, len);
+ ptr = ALLOCV_N(WCHAR, v, len);
MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, ptr, len);
f = CreateFileW(ptr, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
rb_w32_iswin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS,
NULL);
+ ALLOCV_END(v);
if (f == INVALID_HANDLE_VALUE) return f;
ret = f;
}