Issue #9608 has been updated by tadayoshi funaba.


i'd like to try it; please commit it.

----------------------------------------
Bug #9608: [PATCH] avoid large alloca on Complex/Rational calls
https://bugs.ruby-lang.org/issues/9608#change-46456

* Author: Eric Wong
* Status: Open
* Priority: Normal
* Assignee: tadayoshi funaba
* Category: core
* Target version: 
* ruby -v: ruby 2.2.0dev (2014-03-07 trunk 45281) [x86_64-linux]
* Backport: 1.9.3: UNKNOWN, 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
* complex.c (parse_comp): replace ALLOCA_N with ALLOCV_N/ALLOCV_END
* rational.c (read_digits): ditto

This fixes segfaults on:

	Rational("1" * 16 * 1024 * 1024)
	Complex("1" * 16 * 1024 * 1024)

On my system where my stack size is only 8M.

tadf: Should we raise an exception on large string instead?
Large strings are slow to parse and could still be a DoS.


---Files--------------------------------
0001-avoid-large-alloca-on-Complex-Rational-calls.patch (1.86 KB)


-- 
https://bugs.ruby-lang.org/