core: fix infinite loop when a regex gives an empty match (bug #38112)
parent
df2867ac27
commit
0ad8866d6b
|
@ -1,12 +1,13 @@
|
|||
WeeChat ChangeLog
|
||||
=================
|
||||
Sébastien Helleu <flashcode@flashtux.org>
|
||||
v0.4.0-rc3, 2013-01-17
|
||||
v0.4.0-rc3, 2013-01-18
|
||||
|
||||
|
||||
Version 0.4.0 (under dev!)
|
||||
--------------------------
|
||||
|
||||
* core: fix infinite loop when a regex gives an empty match (bug #38112)
|
||||
* core: fix detection of guile in configure
|
||||
* core: fix click in item "buffer_nicklist" when nicklist is a root bar
|
||||
(bug #38080)
|
||||
|
|
|
@ -990,7 +990,13 @@ string_has_highlight_regex_compiled (const char *string, regex_t *regex)
|
|||
while (string && string[0])
|
||||
{
|
||||
rc = regexec (regex, string, 1, ®ex_match, 0);
|
||||
if ((rc != 0) || (regex_match.rm_so < 0) || (regex_match.rm_eo < 0))
|
||||
|
||||
/*
|
||||
* no match found: exit the loop (if rm_eo == 0, it is an empty match
|
||||
* at beginning of string: we consider there is no match, to prevent an
|
||||
* infinite loop)
|
||||
*/
|
||||
if ((rc != 0) || (regex_match.rm_so < 0) || (regex_match.rm_eo <= 0))
|
||||
break;
|
||||
|
||||
startswith = (regex_match.rm_so == 0);
|
||||
|
|
Loading…
Reference in New Issue