summaryrefslogtreecommitdiffhomepage
path: root/src/variable.c
diff options
context:
space:
mode:
authorYukihiro Matz Matsumoto <[email protected]>2012-11-14 17:17:37 +0900
committerYukihiro Matz Matsumoto <[email protected]>2012-11-14 17:17:37 +0900
commit1993f934f2c2fd7baa88ca45dc9a0c74743a3920 (patch)
tree76d984865e9c8ac6ee7d032d50b8b2aedda0c6c9 /src/variable.c
parent73dda8cb41b0c1864db376dd986694de0e296293 (diff)
downloadmruby-1993f934f2c2fd7baa88ca45dc9a0c74743a3920.tar.gz
mruby-1993f934f2c2fd7baa88ca45dc9a0c74743a3920.zip
out of bound access in iv seglist
Diffstat (limited to 'src/variable.c')
-rw-r--r--src/variable.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/variable.c b/src/variable.c
index 19853685c..7d583da40 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -71,13 +71,13 @@ iv_put(mrb_state *mrb, iv_tbl *t, mrb_sym sym, mrb_value val)
t->size++;
return;
}
- if (key == 0 && !matched_seg) {
+ if (!matched_seg && key == 0) {
matched_seg = seg;
matched_idx = i;
}
else if (key == sym) {
- seg->val[i] = val;
- return;
+ seg->val[i] = val;
+ return;
}
}
prev = seg;
@@ -223,10 +223,10 @@ iv_copy(mrb_state *mrb, iv_tbl *t)
mrb_sym key = seg->key[i];
mrb_value val = seg->val[i];
- iv_put(mrb, t2, key, val);
if ((seg->next == NULL) && (i >= t->last_len)) {
return t2;
}
+ iv_put(mrb, t2, key, val);
}
seg = seg->next;
}