From d1496e8b8cfd3554a4ce72c33d42e4cb33667e96 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 16 Jun 2015 09:45:50 +0000 Subject: date_strptime.c: use ALLOCV * ext/date/date_strptime.c (read_digits): use ALLOCV instead of ALLOCA get rid of stack overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/date/date_strptime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c index e318af19f3..4f93219317 100644 --- a/ext/date/date_strptime.c +++ b/ext/date/date_strptime.c @@ -103,10 +103,12 @@ read_digits(const char *s, VALUE *n, size_t width) return l; } else { - char *s2 = ALLOCA_N(char, l + 1); + VALUE vbuf = 0; + char *s2 = ALLOCV_N(char, vbuf, l + 1); memcpy(s2, s, l); s2[l] = '\0'; *n = rb_cstr_to_inum(s2, 10, 0); + ALLOCV_END(vbuf); return l; } } -- cgit v1.2.3