re.c (match_set_string): add a check for memory allocation
Found by Coverity Scan
This commit is contained in:
parent
7ebf9da788
commit
ebc2198d9f
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…
x
Reference in New Issue
Block a user