mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
re.c (match_set_string): add a check for memory allocation
Found by Coverity Scan
This commit is contained in:
parent
7ebf9da788
commit
ebc2198d9f
1 changed files with 2 additions and 1 deletions
3
re.c
3
re.c
|
@ -1333,7 +1333,8 @@ match_set_string(VALUE m, VALUE string, long pos, long len)
|
|||
|
||||
match->str = string;
|
||||
match->regexp = Qnil;
|
||||
onig_region_resize(&rmatch->regs, 1);
|
||||
int err = onig_region_resize(&rmatch->regs, 1);
|
||||
if (err) rb_memerror();
|
||||
rmatch->regs.beg[0] = pos;
|
||||
rmatch->regs.end[0] = pos + len;
|
||||
OBJ_INFECT(match, string);
|
||||
|
|
Loading…
Reference in a new issue