# Integer overflow in Array#fill

**URL:** <https://www.ruby-forum.com/t/integer-overflow-in-array-fill/113840>\
**Category:** Development\
**Created:** [September 5, 2007, 2:07pm UTC](https://www.ruby-forum.com/t/integer-overflow-in-array-fill/113840 "2007-09-05T14:07:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheepman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepman](https://www.ruby-forum.com/u/sheepman)\
**Post date:** [September 5, 2007, 2:07pm UTC](https://www.ruby-forum.com/t/integer-overflow-in-array-fill/113840/1 "2007-09-05T14:07:36Z")

</div>

e$B$3$s$P$s$Oe(B sheepman e$B$G$9!#e(B

Array#fill e$B$G$be(B integer overflow e$B$,5/$-$^$9!#e(B

$ cat integer\_overflow.rb  
a = [0, 1, 2, 3]  
a.fill(10, 1, 2\*\*31-1)  
p a

a = [0, 1, 2, 3]  
a.fill(10, 1, 5)  
p a

$ ruby-1.8 -v integer\_overflow.rb  
ruby 1.8.6 (2007-09-01 patchlevel 5000) [i686-linux]  
[0, 1, 2, 3]  
[0, 10, 10, 10, 10, 10]
