Integer overflow in Array#[]=

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

Array#[]= e$B$Ge(B integer overflow e$B$,H/@8$7$^$9!#e(B

$ cat integer_overflow.rb
a = [0, 1, 2, 3]
a[1, 2**31-1] = 10
p a

a = [0, 1, 2, 3]
a[1, 2**31-2] = 10
p a

$ ruby-1.8 -v integer_overflow.rb
ruby 1.8.6 (2007-09-01 patchlevel 5000) [i686-linux]
[]
[0, 10]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs