diff options
| author | take_cheeze <[email protected]> | 2014-02-22 00:05:05 +0900 |
|---|---|---|
| committer | take_cheeze <[email protected]> | 2014-02-22 00:05:05 +0900 |
| commit | a9af8c9c0706040f7a472ce5e4dd0ee5c8747436 (patch) | |
| tree | d8f862ac88bc2d3ba0126b7ceb5f390b2e1c51bd /mrbgems/mruby-hash-ext | |
| parent | 36e234aa377d50d8ee425c7868e0651cf78e85cf (diff) | |
| download | mruby-a9af8c9c0706040f7a472ce5e4dd0ee5c8747436.tar.gz mruby-a9af8c9c0706040f7a472ce5e4dd0ee5c8747436.zip | |
fix possible arena overflow
Diffstat (limited to 'mrbgems/mruby-hash-ext')
| -rw-r--r-- | mrbgems/mruby-hash-ext/src/hash-ext.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mrbgems/mruby-hash-ext/src/hash-ext.c b/mrbgems/mruby-hash-ext/src/hash-ext.c index 298559686..937a7fddd 100644 --- a/mrbgems/mruby-hash-ext/src/hash-ext.c +++ b/mrbgems/mruby-hash-ext/src/hash-ext.c @@ -23,12 +23,14 @@ static mrb_value hash_values_at(mrb_state *mrb, mrb_value hash) { mrb_value *argv, result; - int argc, i; + int argc, i, ai; mrb_get_args(mrb, "*", &argv, &argc); result = mrb_ary_new_capa(mrb, argc); + ai = mrb_gc_arena_save(mrb); for (i = 0; i < argc; i++) { mrb_ary_push(mrb, result, mrb_hash_get(mrb, hash, argv[i])); + mrb_gc_arena_restore(mrb, ai); } return result; } |
