From 4d63c8503100b3683ea4eee14a39bbdee3d04c20 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 1 Dec 2014 19:43:10 +0000 Subject: re.c: check if onig_region_copy failed * re.c (CHECK_REGION_COPIED): onig_region_copy() can fail when memory exhausted but returns nothing, so check by if allocated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/strscan/strscan.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ext') diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index acb7c61230..780cda08b1 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -252,6 +252,7 @@ strscan_init_copy(VALUE vself, VALUE vorig) self->prev = orig->prev; self->curr = orig->curr; onig_region_copy(&self->regs, &orig->regs); + if (self->regs.allocated) rb_memerror(); } return vself; -- cgit v1.2.3