From e4cac77252307c3311d2d799e064fb27f921b3d3 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Sun, 15 Jun 2008 13:18:59 +0000 Subject: merge revision(s) 16143: * regex.c (re_search): string might be NULL. [ruby-core:16478] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@17254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- regex.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'regex.c') diff --git a/regex.c b/regex.c index a7a831286e..45f7e20738 100644 --- a/regex.c +++ b/regex.c @@ -3177,6 +3177,10 @@ re_search(bufp, string, size, startpos, range, regs) /* Check for out-of-range starting position. */ if (startpos < 0 || startpos > size) return -1; + if (!string) { + if (size == 0) string = ""; + else return -1; + } /* Update the fastmap now if not correct already. */ if (fastmap && !bufp->fastmap_accurate) { -- cgit v1.2.3