Dominique wrote:

> I noticed a crash in Vim-7.4.244 easy to reproduce:
> 
> $ vim -u NONE -N  -c '&&'
> Vim: Caught deadly signal SEGV
> Vim: Finished.
> Segmentation fault (core dumped)
> 
> (see  :help :s_flags  for description of :&&)
> 
> Bug is introduced by this recent patch:
> 
> changeset:   5792:8d1ba0a23588
> tag:         v7-4-240
> user:        Bram Moolenaar <[email protected]>
> date:        Wed Apr 02 17:19:04 2014 +0200
> files:       src/tag.c src/version.c
> description:
> updated for version 7.4.240
> Problem:    ":tjump" shows "\n" as "\\n".
> Solution:   Skip over "\" that escapes a backslash. (Gary Johnson)
> 
> (gdb) bt
> #0  0x00007f035583c707 in kill () from /lib/x86_64-linux-gnu/libc.so.6
> #1  0x00000000004d4297 in may_core_dump () at os_unix.c:3358
> #2  0x00000000004d5ce3 in mch_exit (r=1) at os_unix.c:3324
> #3  0x000000000055836b in getout (exitval=1) at main.c:1500
> #4  0x00000000004a4dcc in preserve_exit () at misc1.c:9166
> #5  0x00000000004d4d25 in deathtrap (sigarg=11) at os_unix.c:1121
> #6  <signal handler called>
> #7  do_sub (eap=0x7ffffd8623a0) at ex_cmds.c:4428
> #8  0x0000000000458618 in do_one_cmd (cookie=0x7ffffd862ae0,
> fgetline=0x44d42a <getsourceline>, cstack=0x7ffffd862540, sourcing=1,
> cmdlinep=0x7ffffd8
> 62510) at ex_docmd.c:2701
> #9  do_cmdline (cmdline=<optimized out>, fgetline=0x44d42a
> <getsourceline>, cookie=0x7ffffd862ae0, flags=7) at ex_docmd.c:1126
> #10 0x000000000044dca0 in do_source (fname=0xcbf6e4 "vim.h",
> check_other=<optimized out>, is_vimrc=<optimized out>) at
> ex_cmds2.c:3312
> #11 0x000000000044df12 in cmd_source (fname=0xcbf6e4 "vim.h",
> eap=<optimized out>) at ex_cmds2.c:2921
> #12 0x000000000044df46 in ex_source (eap=<optimized out>) at ex_cmds2.c:2894
> #13 0x0000000000458618 in do_one_cmd (cookie=0x0, fgetline=0x0,
> cstack=0x7ffffd862e60, sourcing=1, cmdlinep=0x7ffffd862e30) at
> ex_docmd.c:2701
> #14 do_cmdline (cmdline=<optimized out>, fgetline=0x0, cookie=0x0,
> flags=11) at ex_docmd.c:1126
> #15 0x0000000000459d86 in do_cmdline_cmd (cmd=<optimized out>) at 
> ex_docmd.c:731
> #16 0x000000000055b994 in exe_commands (parmp=0x7ffffd8633e0) at main.c:2894
> #17 main (argc=<optimized out>, argv=<optimized out>) at main.c:936
> 
> ...
> (gdb) up
> #7  do_sub (eap=0x7ffffd8623a0) at ex_cmds.c:4428
> (gdb) p pat
> $2 = (char_u *) 0x0
> 
> Attached patch fixes it by checking that 'pat' is not NULL.
> 
> I also removed the condition "STRLEN(pat) == 2" because it looks
> redundant with the condition just before it: "STRCMP(pat, "\\n") == 0".

Thanks, I'll include it.

This also uncovers that the special case is not used when repeating the
same substitute.  That's a bit more work to fix.

-- 
Now it is such a bizarrely improbable coincidence that anything as
mind-bogglingly useful as the Babel fish could have evolved purely by chance
that some thinkers have chosen to see it as a final and clinching proof of the
NON-existence of God.
The argument goes something like this: 'I refuse to prove that I exist,' says
God, 'for proof denies faith, and without faith I am nothing.'
'But,' says Man, 'the Babel fish is a dead giveaway, isn't it?  It could not
have evolved by chance.  It proves you exist, and so therefore, by your own
arguments, you don't.  QED.'
'Oh dear,' says God, 'I hadn't thought of that,' and promptly vanishes in a
puff of logic.
'Oh, that was easy,' says Man, and for an encore goes on to prove that black
is white and gets himself killed on the next pedestrian crossing.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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.

Raspunde prin e-mail lui