Bug 815314 - bash range expansion with large numbers causes DoS
bash range expansion with large numbers causes DoS
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: bash (Show other bugs)
16
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Roman Rakus
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-23 06:45 EDT by ojab
Modified: 2014-01-12 19:14 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-23 08:53:39 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description ojab 2012-04-23 06:45:00 EDT
Description of problem:
I'm using bash for loops with large-number ranges like {99450..99459} and one time typo led me to {994450..99459}, which led me to unresponsive system till OOM-killer.

Version-Release number of selected component (if applicable):
Name        : bash
Arch        : x86_64
Version     : 4.2.24
Release     : 1.fc16


Steps to Reproduce:
1. for i in {1..9999999}; do echo ${i} ; done
  
Actual results:
bash that cannot be killed via Ctrl-C/`kill` (`kill -9` works) and eats a LOT of RAM.

Expected results:
Expansion works or throws error (`too large number` or something like)

Additional info:
Also reproducible on Centos-5.8 x86_64.
Comment 1 Roman Rakus 2012-04-23 08:53:39 EDT
This is expected behaviour. It was several times discussed upstream. You should use c-style for cycle in this case.

Note You need to log in before you can comment on or make changes to this bug.