Permalink
Browse files

Add ary_modify() checks; close #3379

This issue was reported by https://hackerone.com/an0n-j
  • Loading branch information...
matz committed Jan 7, 2017
1 parent 8c11b04 commit 392d7fbef9aa64134b33ac562f125df45b450ec0
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/array.c
View
@@ -440,6 +440,7 @@ mrb_ary_pop(mrb_state *mrb, mrb_value ary)
{
struct RArray *a = mrb_ary_ptr(ary);
ary_modify(mrb, a);
if (a->len == 0) return mrb_nil_value();
return a->ptr[--a->len];
}
@@ -452,6 +453,7 @@ mrb_ary_shift(mrb_state *mrb, mrb_value self)
struct RArray *a = mrb_ary_ptr(self);
mrb_value val;
ary_modify(mrb, a);
if (a->len == 0) return mrb_nil_value();
if (ARY_SHARED_P(a)) {
L_SHIFT:
@@ -964,6 +966,7 @@ mrb_ary_clear(mrb_state *mrb, mrb_value self)
{
struct RArray *a = mrb_ary_ptr(self);
ary_modify(mrb, a);
if (ARY_SHARED_P(a)) {
mrb_ary_decref(mrb, a->aux.shared);
ARY_UNSET_SHARED_FLAG(a);

0 comments on commit 392d7fb

Please sign in to comment.