diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-27 09:35:56 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-27 09:35:56 +0000 |
commit | 18c11392aff96003cc6713b447a160c20d66a0a6 (patch) | |
tree | 9de4e17e0039db2043deb341f613e808651a2dea | |
parent | 21931d6aa2fb5dc0b2d058323cba33bc5772653e (diff) |
* file.c (w32_io_info): get rid of too huge alloca().
[Bug #4313] [ruby-core:34830]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | file.c | 5 |
2 files changed, 9 insertions, 1 deletions
@@ -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(). @@ -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; } |