Project

General

Profile

Actions

Bug #9608

closed

[PATCH] avoid large alloca on Complex/Rational calls

Added by normalperson (Eric Wong) about 10 years ago. Updated almost 10 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.2.0dev (2014-03-07 trunk 45281) [x86_64-linux]
[ruby-core:61357]

Description

  • 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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0