mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* 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@16143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e103da4e61
commit
4ba8ba144e
2 changed files with 8 additions and 0 deletions
4
regex.c
4
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue