From: normalperson@... Date: 2014-03-07T09:55:59+00:00 Subject: [ruby-core:61357] [ruby-trunk - Bug #9608] [Open] [PATCH] avoid large alloca on Complex/Rational calls Issue #9608 has been reported by Eric Wong. ---------------------------------------- Bug #9608: [PATCH] avoid large alloca on Complex/Rational calls https://bugs.ruby-lang.org/issues/9608 * 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. -- http://bugs.ruby-lang.org/