Commit 000a3119 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #3364 from ksss/string2

Check overflow string length
parents ede04d68 c626b823
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment