Bug 815314 - bash range expansion with large numbers causes DoS
Summary: bash range expansion with large numbers causes DoS
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: bash
Version: 16
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Roman Rakus
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-23 10:45 UTC by ojab
Modified: 2014-01-13 00:14 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-04-23 12:53:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description ojab 2012-04-23 10:45:00 UTC
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 12:53:39 UTC
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.