On Tue, Aug 13, 2013 at 09:03:36PM +0200, Dominique Pellé wrote:
> I could narrow it down further.  I can reproduce it with:
> 
> # Create a file (6 space and a x, bug does not happen with less than 6 
> spaces):
> $ echo "      x" > foo
> $ valgrind --log-file=valgrind.log vim -u NONE -N -c 'syn on' foo.rb
> 
> Then in Vim-7.4 (huge, Linux x86_64) search for:
> /\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!
> 
> and observe errors in valgrind.log.

The attached patch fixes this.

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <[email protected]>
diff --git a/src/po/pl.UTF-8.po b/src/po/pl.UTF-8.po
--- a/src/po/pl.UTF-8.po
+++ b/src/po/pl.UTF-8.po
@@ -14,7 +14,7 @@
 "Last-Translator: Mikolaj Machowski <[email protected]>\n"
 "Language: pl\n"
 "MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "X-Generator: Lokalize 1.0\n"
 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -4166,6 +4166,15 @@
 
 	    subs = addstate(l, state->out, subs, pim, off);
 
+	    /* If addstate called realloc(), sub may point to invalid data, so
+	     * it needs to be reset */
+#ifdef FEAT_SYN_HL
+	    if (state->c >= NFA_ZOPEN && state->c <= NFA_ZOPEN9)
+		sub = &subs->synt;
+	    else
+#endif
+		sub = &subs->norm;
+
 	    if (save_in_use == -1)
 	    {
 		if (REG_MULTI)
@@ -4258,6 +4267,15 @@
 
 	    subs = addstate(l, state->out, subs, pim, off);
 
+	    /* If addstate called realloc(), sub may point to invalid data, so
+	     * it needs to be reset */
+#ifdef FEAT_SYN_HL
+	    if (state->c >= NFA_ZCLOSE && state->c <= NFA_ZCLOSE9)
+		sub = &subs->synt;
+	    else
+#endif
+		sub = &subs->norm;
+
 	    if (REG_MULTI)
 		sub->list.multi[subidx].end = save_lpos;
 	    else

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui