Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11360

Re: Integer Overflow in braces

Path csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: Integer Overflow in braces
Date Mon, 17 Aug 2015 08:20:26 -0400
Lines 14
Approved bug-bash@gnu.org
Message-ID <mailman.8480.1439814061.904.bug-bash@gnu.org> (permalink)
References <CABq52TYThGj9OtBn3xTti5scmA=WdnS7ULw3G6GMayPK6WR0+w@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1439814061 17236 208.118.235.17 (17 Aug 2015 12:21:01 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org
To Pasha K <pashakravtsov@gmail.com>
Envelope-to bug-bash@gnu.org
Content-Disposition inline
In-Reply-To <CABq52TYThGj9OtBn3xTti5scmA=WdnS7ULw3G6GMayPK6WR0+w@mail.gmail.com>
User-Agent Mutt/1.4.2.3i
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 139.137.100.1
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11360

Show key headers only | View raw


On Sat, Aug 15, 2015 at 08:53:55PM -0700, Pasha K wrote:
> (gdb) r -c "for x in {1..9223372036854775805}; do echo overflow; done"

Brace expansion requires bash to generate and store ALL of those strings
in memory simultaneously.  I seriously doubt any computer on earth has
enough virtual memory to hold what you've asked for here.  (Unless I'm
miscounting, you've asked bash to generate over 900 quintillion strings
of length varying from 1 to 19 bytes in length (2 to 20 with NULs).)

If you want to count to a large number, use a C-style for loop instead
of a brace expansion.

for ((x=1; x<=9000000000; x++)); do ...; done

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Integer Overflow in braces Greg Wooledge <wooledg@eeg.ccf.org> - 2015-08-17 08:20 -0400

csiph-web