diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-12-25 01:35:44 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2016-12-25 01:35:44 +0900 |
| commit | 000a3119ca152db12c6e36501b65e27a8be9a53e (patch) | |
| tree | 9751a4b28b16f4c0242f68527418ac89df61f71c | |
| parent | ede04d68b3085c542af5c7d3099f846e3f94be7d (diff) | |
| parent | c626b823cabf8ee7acbdf57e44597de3974c5f17 (diff) | |
| download | mruby-000a3119ca152db12c6e36501b65e27a8be9a53e.tar.gz mruby-000a3119ca152db12c6e36501b65e27a8be9a53e.zip | |
Merge pull request #3364 from ksss/string2
Check overflow string length
| -rw-r--r-- | src/string.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c index a177aafba..56eeef3a2 100644 --- a/src/string.c +++ b/src/string.c @@ -759,6 +759,9 @@ mrb_str_concat(mrb_state *mrb, mrb_value self, mrb_value other) } len = RSTR_LEN(s1) + RSTR_LEN(s2); + if (len < 0 || len >= MRB_INT_MAX) { + mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big"); + } if (RSTRING_CAPA(self) < len) { resize_capa(mrb, s1, len); } |
