Merge pull request #1763 from cubicdaiya/issues/mrb_str_new_static_bug

fix SEGV bug for mrb_str_new_static
This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-02-28 09:59:00 +09:00
+3
View File
@@ -256,6 +256,9 @@ mrb_value
mrb_str_new_static(mrb_state *mrb, const char *p, size_t len)
{
struct RString *s;
if ((mrb_int)len < 0) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "negative string size (or size too big)");
}
s = mrb_obj_alloc_string(mrb);
s->len = len;