mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user