summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-01 19:43:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-01 19:43:10 +0000
commit4d63c8503100b3683ea4eee14a39bbdee3d04c20 (patch)
tree4f92440094be7823043b284f2c1adebee2c05c4e /ext
parent11dc42c20ca3cf3be6003fa303eb5649c00ab411 (diff)
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
Diffstat (limited to 'ext')
-rw-r--r--ext/strscan/strscan.c1
1 files changed, 1 insertions, 0 deletions
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;