# \[Bug #3236\] ISeq.load $B$G(B \[BUG\] iseq\_set\_sequence: ic\_index overflow $B$,H/@8(B

**URL:** <https://www.ruby-forum.com/t/bug-3236-iseq-load-b-g-b-bug-iseq-set-sequence-ic-index-overflow-b-h-8-b/187936>\
**Category:** Development\
**Created:** [May 2, 2010, 5:10pm UTC](https://www.ruby-forum.com/t/bug-3236-iseq-load-b-g-b-bug-iseq-set-sequence-ic-index-overflow-b-h-8-b/187936 "2010-05-02T17:10:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomoyuki\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c0e974/32.png) [@Tomoyuki\_C](https://www.ruby-forum.com/u/Tomoyuki_C)\
**Post date:** [May 2, 2010, 5:10pm UTC](https://www.ruby-forum.com/t/bug-3236-iseq-load-b-g-b-bug-iseq-set-sequence-ic-index-overflow-b-h-8-b/187936/1 "2010-05-02T17:10:24Z")

</div>

Bug #3236: ISeq.load e$B$Ge(B [BUG] iseq\_set\_sequence: ic\_index overflow  
e$B$,H/@8e(B  
[http://redmine.ruby-lang.org/issues/show/3236](http://redmine.ruby-lang.org/issues/show/3236)

e$B5/I\<\<Te(B: Tomoyuki C.  
e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal  
e$BC4Ev\<Te(B: Koichi Sasada, e$B%+%F%4%je(B: YARV  
ruby -v: ruby 1.9.2dev (2010-05-02 trunk 27590) [x86\_64-darwin10.3.0]

RubyGems e$B$Ne(B iseq  
e$B%i%$%V%i%j$rMxMQ$7$F!"Dj?t$d%$%s%9%?%s%9JQ?t$N;2\>H$r4^$`%9%/%j%W%H$r%3%s%Q%$%k$7$?$b$N$re(B  
load e$B$7$h$&$H$9$k$H0J2\<$N$h$&$J%a%C%;!\<%8$G%(%i!\<$K$J$j$^$9!#e(B

$ cat iseq\_load.rb  
require “iseq”

iseq = ISeq.compile(“@a[0]”)  
puts iseq.disasm  
ISeq.load(iseq.to\_a)

$ ruby-trunk -v iseq\_load.rb  
ruby 1.9.2dev (2010-05-02 trunk 27590) [x86\_64-darwin10.3.0]  
== disasm: \<RubyVM::InstructionSequence:@\>==========  
0000 trace 1 (  
1)  
0002 getinstancevariable :@a, ic:0  
0005 putobject 0  
0007 opt\_aref ic:2  
0009 leave  
iseq\_load.rb:5: [BUG] iseq\_set\_sequence: ic\_index overflow: index: 2,  
size: 0  
ruby 1.9.2dev (2010-05-02 trunk 27590) [x86\_64-darwin10.3.0]

## – control frame ---------- c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :load c:0003 p:0075 s:0007 b:0007 l:0014a8 d:000bc0 EVAL iseq\_load.rb:5 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH c:0001 p:0000 s:0002 b:0002 l:0014a8 d:0014a8 TOP

## – Ruby level backtrace information

iseq\_load.rb:5:in `<main>' iseq_load.rb:5:in `load’

## – C level backtrace information

0 ruby-trunk 0x0000000100177acb  
rb\_vm\_bugreport + 120  
1 ruby-trunk 0x0000000100034f90 report\_bug +  
313  
2 ruby-trunk 0x00000001000350b5 rb\_bug + 241  
3 ruby-trunk 0x000000010014a328  
iseq\_set\_sequence + 2456  
4 ruby-trunk 0x0000000100148f1c iseq\_setup +  
118  
5 ruby-trunk 0x00000001001590e5  
iseq\_build\_body + 2250  
6 ruby-trunk 0x000000010015989f  
rb\_iseq\_build\_from\_ary + 1789  
7 ruby-trunk 0x000000010015bbe3 iseq\_load +  
1788  
8 ruby-trunk 0x000000010015bcb2 rb\_iseq\_load

- 47  
9 iseq.bundle 0x0000000100540eb5 iseq\_s\_load +  
53  
10 ruby-trunk 0x000000010016b040 call\_cfunc +  
282  
11 ruby-trunk 0x000000010016aea7 vm\_call\_cfunc
- 284  
12 ruby-trunk 0x000000010016a07c  
vm\_call\_method + 373  
13 ruby-trunk 0x0000000100164cae vm\_exec\_core
- 11207  
14 ruby-trunk 0x00000001001745e9 vm\_exec + 147  
15 ruby-trunk 0x0000000100174fca  
rb\_iseq\_eval\_main + 45  
16 ruby-trunk 0x0000000100039cd9  
ruby\_exec\_internal + 193  
17 ruby-trunk 0x0000000100039dfd  
ruby\_exec\_node + 30  
18 ruby-trunk 0x0000000100039dd0 ruby\_run\_node
- 56  
19 ruby-trunk 0x0000000100000dcb main + 79  
20 ruby-trunk 0x0000000100000d74 start + 52  
21 ??? 0x0000000000000003 0x0 + 3

[NOTE]  
You may have encountered a bug in the Ruby interpreter or extension  
libraries.  
Bug reports are welcome.  
For details: [http://www.ruby-lang.org/bugreport.html](http://www.ruby-lang.org/bugreport.html)

e$BG[Ns$+$ie(B iseq  
e$B$r9=C[$9$k;~$K%$%s%i%$%s%-%c%C%7%e$N%5%$%:e(B(ic\_size)e$B$rI|85$7$F$$$J$$0Y$N$h$&$G$9!#0J2\<$N=$@5$G!"e(Bmake  
check  
e$B$G%(%i!\<$,A}$($J$$$3$H$H!“I8=`E:IU$N%i%$%V%i%je(B($prefix/lib/ruby/1.9.1/\*\*/\*.rb)e$B$,A4$Fe(B  
ISeq.load e$B$G$-$k$3$H$r3NG’$7$^$7$?!#e(B  
e$B$D$$$G$K!”\>e5-$G$R$C$+$+$C$F$$$ke(B ic\_index e$B$He(B ic\_size  
e$B$N%A%'%C%/$K$OEy9f$,H4$1$F$$$k$h$&$G$7$?$N$G$=$l$bDI2C$7$F$$$^$9!#e(B

# Index: compile.c

— compile.c (revision 27590)  
+++ compile.c (working copy)  
@@ -1434,7 +1434,7 @@  
{  
int ic\_index = FIX2INT(operands[j]);  
IC ic = &iseq-\>ic\_entries[ic\_index];

- 

```
     if (UNLIKELY(ic_index > iseq->ic_size)) {

```

- 

```
     if (UNLIKELY(ic_index >= iseq->ic_size)) {
   rb_bug("iseq_set_sequence: ic_index overflow: index: %d, size: 

```

%d",  
ic\_index, iseq-\>ic\_size);  
}  
@@ -5269,6 +5269,8 @@  
break;  
case TS\_IC:  
argv[j] = op;

- 

```
 if (NUM2INT(op) >= iseq->ic_size)

```

- 

```
     iseq->ic_size = NUM2INT(op) + 1;
 break;
     case TS_ID:
 argv[j] = rb_convert_type(op, T_SYMBOL,

```
