1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* re.c (match_inspect): avoid SEGV with MatchData.allocate.inspect.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-02-16 11:13:47 +00:00
parent bb831578c5
commit 60fa63b819
2 changed files with 8 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Sat Feb 16 20:12:47 2008 Tanaka Akira <akr@fsij.org>
* re.c (match_inspect): avoid SEGV with MatchData.allocate.inspect.
Sat Feb 16 19:04:17 2008 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (str_strlen): revert r15507. [ruby-dev:33810]

4
re.c
View file

@ -1510,6 +1510,10 @@ match_inspect(VALUE match)
struct backref_name_tag *names;
VALUE regexp = RMATCH(match)->regexp;
if (regexp == 0) {
return rb_sprintf("#<%s:%p>", cname, (void*)match);
}
names = ALLOCA_N(struct backref_name_tag, num_regs);
MEMZERO(names, struct backref_name_tag, num_regs);