1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

2000-06-14

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-06-14 05:30:29 +00:00
parent 00e9a8f0c3
commit abc49e493d
8 changed files with 76 additions and 37 deletions

View file

@ -496,12 +496,14 @@ rb_struct_aset(s, idx, val)
i = NUM2LONG(idx);
if (i < 0) i = RSTRUCT(s)->len + i;
if (i < 0)
if (i < 0) {
rb_raise(rb_eIndexError, "offset %d too small for struct(size:%d)",
i, RSTRUCT(s)->len);
if (RSTRUCT(s)->len <= i)
}
if (RSTRUCT(s)->len <= i) {
rb_raise(rb_eIndexError, "offset %d too large for struct(size:%d)",
i, RSTRUCT(s)->len);
}
if (OBJ_FROZEN(s)) rb_error_frozen("Struct");
return RSTRUCT(s)->ptr[i] = val;
}