diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-02-22 10:55:04 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-02-22 10:55:04 +0900 |
| commit | 6b6c590fe356b4180673df30423a672e4a8e5316 (patch) | |
| tree | 867556df737016403330af4823dc398e3faa3e51 /mrbgems/mruby-hash-ext/src | |
| parent | 96e806ff052012de3f345ef95da3a3d2334f7f4a (diff) | |
| parent | 658b4f4ea7bada3264f8db1802d140dfb0433292 (diff) | |
| download | mruby-6b6c590fe356b4180673df30423a672e4a8e5316.tar.gz mruby-6b6c590fe356b4180673df30423a672e4a8e5316.zip | |
Merge pull request #1722 from take-cheeze/hash_ext_arena_fix
Fix possible arena overflow in mruby-hast-ext.
Diffstat (limited to 'mrbgems/mruby-hash-ext/src')
| -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; } |
