diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-02-28 01:44:09 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-02-28 01:44:09 +0900 |
| commit | 25822f2430eb31ecf012264a53f6a82fc7d6ad30 (patch) | |
| tree | 3772b9bece85573c36284dedcd30f6443b760aa7 /src/string.c | |
| parent | 90c54d1ead5eeec223d8da0b88ce88d3da9756ff (diff) | |
| parent | 30fe3f5d4b1b2d049c5557f98d4d5addf7bc3dfe (diff) | |
| download | mruby-25822f2430eb31ecf012264a53f6a82fc7d6ad30.tar.gz mruby-25822f2430eb31ecf012264a53f6a82fc7d6ad30.zip | |
Merge pull request #1762 from cubicdaiya/issues/mrb_str_new_bug
fix SEGV bug for mrb_str_new
Diffstat (limited to 'src/string.c')
| -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 719be3ff5..8a9ed8a24 100644 --- a/src/string.c +++ b/src/string.c @@ -216,6 +216,9 @@ mrb_value mrb_str_new(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 = str_new(mrb, p, len); return mrb_obj_value(s); |
