Hi
Running this command with vim-8.0.134 (and older)
built with ubsan (undefined sanitizer) gives an error
on stderr:
$ vim -c '/x\{9223372036854775807}' 2> log
log then contains:
regexp_nfa.c:2172:28: runtime error: signed integer overflow:
9223372036854775807 + 200 cannot be represented in type 'long'
It's easy to fix by swapping 2 conditions as in attached patch.
Regards
Dominique
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index fcca818..fab3e93 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -50,7 +50,7 @@ enum
NFA_CONCAT, /* concatenate two previous items (postfix
* only) */
NFA_OR, /* \| (postfix only) */
- NFA_STAR, /* greedy * (posfix only) */
+ NFA_STAR, /* greedy * (postfix only) */
NFA_STAR_NONGREEDY, /* non-greedy * (postfix only) */
NFA_QUEST, /* greedy \? (postfix only) */
NFA_QUEST_NONGREEDY, /* non-greedy \? (postfix only) */
@@ -2169,7 +2169,7 @@ nfa_regpiece(void)
* maximum is much larger than the minimum and when the maximum is
* large. Bail out if we can use the other engine. */
if ((nfa_re_flags & RE_AUTO)
- && (maxval > minval + 200 || maxval > 500))
+ && (maxval > 500 || maxval > minval + 200))
return FAIL;
/* Ignore previous call to nfa_regatom() */