diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-07-01 18:17:44 -0300 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-07-01 18:17:44 -0300 |
commit | 618a07e8131f49bbda77d2cfe5832218a561a5c8 (patch) | |
tree | ec6ea4a3fffdc9fad7dc8bab3cbdc66673cf292d /lisp/re/re.c | |
parent | 946b5b745d9d326799a23f7210b799e1b690643d (diff) |
Fix a bug in the regex library
The bug causes the regex parser to enter an infinite loop with certain
special patterns with alternatives. Test cases also added to ensure
the bug will be triggered by the tests if it is somehow reinstantiated.
Also testing commit to xedit git repository.
Diffstat (limited to 'lisp/re/re.c')
-rw-r--r-- | lisp/re/re.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/re/re.c b/lisp/re/re.c index abf5cc4..fca7e28 100644 --- a/lisp/re/re.c +++ b/lisp/re/re.c @@ -782,7 +782,8 @@ next_lcstl:; case Re_AltNext: bas = eng.off - 1; /* Check if matched and if it is a better match */ - if (eng.sv[eng.off] - eng.so[eng.off] < + if (eng.eo[eng.off] >= eng.so[eng.off] && + eng.sv[eng.off] - eng.so[eng.off] < eng.eo[eng.off] - eng.so[eng.off]) eng.sv[eng.off] = eng.eo[eng.off]; |