Repository: neovim/neovim

Issue #7889: assert failure in command line syntax highlighting
Created: 2018-01-21T13:37:22Z
nvim --version:

:version
NVIM v0.2.3-495-g2820860ba
Build type: Debug
LuaJIT 2.0.5
Compilation: /usr/bin/cc -Wconversion -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DEC
LARATIONS -D_GNU_SOURCE -I/home/matthew/repos/neovim/build/config -I/home/matthew/repos/neovim/src -I/home/matthew/repos/neovim/.deps/usr/include -I/home/matthew/repos/neovim/.deps/usr/include -I/home/matthew/repos/neovim/.deps/usr/include -I/home/matthew/repos/neovim/.dep
s/usr/include -I/home/matthew/repos/neovim/.deps/usr/include -I/home/matthew/repos/neovim/.deps/usr/include -I/usr/include -I/home/matthew/repos/neovim/build/src/nvim/auto -I/home/matthew/repos/neovim/build/include
Compiled by ...

Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info


Vim (version: ) behaves differently?

:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Dec 19 2017 20:38:43)
Included patches: 1-1415
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +channel           +cryptv            +emacs_tags        -footer            +lambda            +mksession         -mouse_sysmouse    +path_extra        +reltime           +syntax            +textobjects       +viminfo           -xpm
+arabic            +cindent           +cscope            +eval              +fork()            +langmap           +modify_fname      +mouse_urxvt       +perl/dyn          +rightleft         +tag_binary        +timers            +vreplace          +xsmp_interact
+autocmd           +clientserver      +cursorbind        +ex_extra          +gettext           +libcall           +mouse             +mouse_xterm       +persistent_undo   +ruby/dyn          +tag_old_static    +title             +wildignore        +xterm_clipboard
-autoservername    +clipboard         +cursorshape       +extra_search      -hangul_input      +linebreak         +mouseshape        +multi_byte        +postscript        +scrollbind        -tag_any_white     +toolbar           +wildmenu          -xterm_save
+balloon_eval      +cmdline_compl     +dialog_con_gui    +farsi             +iconv             +lispindent        +mouse_dec         +multi_lang        +printer           +signs             +tcl/dyn           +user_commands     +windows
+balloon_eval_term +cmdline_hist      +diff              +file_in_path      +insert_expand     +listcmds          +mouse_gpm         -mzscheme          +profile           +smartindent       +termguicolors     +vertsplit         +writebackup
+browse            +cmdline_info      +digraphs          +find_in_path      +job               +localmap          -mouse_jsbterm     +netbeans_intg     +python/dyn        +startuptime       +terminal          +virtualedit       +X11
++builtin_terms    +comments          +dnd               +float             +jumplist          +lua/dyn           +mouse_netterm     +num64             +python3/dyn       +statusline        +terminfo          +visual            -xfontset
+byte_offset       +conceal           -ebcdic            +folding           +keymap            +menu              +mouse_sgr         +packages          +quickfix          -sun_workshop      +termresponse      +visualextra       +xim
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/c
airo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/harfbuzz -
I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.26/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -l
gdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.26/core_perl/CORE -Wl,
-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.26/core_perl/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lieee -lm

Yes -- no crash

Operating system/version: arch linux
Terminal name/version: xterm
$TERM: xterm-256color

Steps to reproduce using nvim -u NORC
nvim -u NONE
i<C-r>=system('ls *.h')<left><left><left><left><left>'

n.b. have to move to before the * in the command, and ' after the motion is the key that triggers the assertion failure.
Actual behaviour
assert failure
Expected behaviour
no assert failure
Backtrace from the coredump
(gdb) bt
#0  0x00007f85f05aa860 in raise () from /usr/lib/libc.so.6
#1  0x00007f85f05abec9 in abort () from /usr/lib/libc.so.6
#2  0x00007f85f05a30bc in __assert_fail_base () from /usr/lib/libc.so.6
#3  0x00007f85f05a3133 in __assert_fail () from /usr/lib/libc.so.6
#4  0x0000555b77424dc3 in viml_pexpr_handle_bop (pstate=0x7fffcbd90a80, ast_stack=0x7fffcbd908f0, bop_node=0x7f85f004f460, want_node_p=0x7fffcbd8f58c, ast_err=0x7fffcbd90780) at ../src/nvim/viml/parser/expressions.c:1239
#5  0x0000555b7743ed2a in viml_pexpr_parse (pstate=0x7fffcbd90a80, flags=2) at ../src/nvim/viml/parser/expressions.c:2914
#6  0x0000555b77297d3b in color_expr_cmdline (colored_ccline=0x555b777e3a00 <ccline>, ret_ccline_colors=0x555b777e3a60 <ccline+96>) at ../src/nvim/ex_getln.c:2463
#7  0x0000555b772984e7 in color_cmdline (colored_ccline=0x555b777e3a00 <ccline>) at ../src/nvim/ex_getln.c:2578
#8  0x0000555b77298f5c in draw_cmdline (start=11, len=6) at ../src/nvim/ex_getln.c:2737
#9  0x0000555b7729a876 in put_on_cmdline (str=0x555b777f1180 <IObuff> "'", len=1, redraw=1) at ../src/nvim/ex_getln.c:3118
#10 0x0000555b77296969 in command_line_handle_key (s=0x7fffcbd911b0) at ../src/nvim/ex_getln.c:1739
#11 0x0000555b77294a02 in command_line_execute (state=0x7fffcbd911b0, key=39) at ../src/nvim/ex_getln.c:1013
#12 0x0000555b773ec97e in state_enter (s=0x7fffcbd911b0) at ../src/nvim/state.c:67
#13 0x0000555b77292d8c in command_line_enter (firstc=61, count=0, indent=0) at ../src/nvim/ex_getln.c:384
#14 0x0000555b77296f24 in getcmdline (firstc=61, count=0, indent=0) at ../src/nvim/ex_getln.c:1920
#15 0x0000555b77332915 in get_expr_register () at ../src/nvim/ops.c:667
#16 0x0000555b7720c59d in ins_reg () at ../src/nvim/edit.c:7033
#17 0x0000555b77200083 in insert_handle_key (s=0x7fffcbd91540) at ../src/nvim/edit.c:867
#18 0x0000555b771ff9c6 in insert_execute (state=0x7fffcbd91540, key=18) at ../src/nvim/edit.c:764
#19 0x0000555b773ec97e in state_enter (s=0x7fffcbd91540) at ../src/nvim/state.c:67
#20 0x0000555b771fefb7 in insert_enter (s=0x7fffcbd91540) at ../src/nvim/edit.c:458
#21 0x0000555b77200a9c in edit (cmdchar=105, startln=false, count=1) at ../src/nvim/edit.c:1327
#22 0x0000555b773302a6 in invoke_edit (cap=0x7fffcbd91740, repl=0, cmd=105, startln=0) at ../src/nvim/normal.c:7583
#23 0x0000555b7733023c in nv_edit (cap=0x7fffcbd91740) at ../src/nvim/normal.c:7555
#24 0x0000555b77321492 in normal_execute (state=0x7fffcbd916a0, key=105) at ../src/nvim/normal.c:1136
#25 0x0000555b773ec97e in state_enter (s=0x7fffcbd916a0) at ../src/nvim/state.c:67
#26 0x0000555b7731f7a4 in normal_enter (cmdwin=false, noexmode=false) at ../src/nvim/normal.c:466
#27 0x0000555b772e4b48 in main (argc=3, argv=0x7fffcbd919f8) at ../src/nvim/main.c:572

Duplicate issue #11852: Nvim crashes after entering /0x symbols inside expression register
Created: 2020-02-11T15:55:16Z
nvim --version: v0.4.3
vim -u DEFAULTS (version: 8.0) behaves differently? it doesn't crash
Operating system/version: Ubuntu 18.04.3 LTS
Terminal name/version: GNOME Terminal 3.28.2 using VTE 0.52.2 +GNUTLS -PCRE2
$TERM: xterm-256color

Steps to reproduce using nvim -u NORC
nvim -u NORC
i<C-r>=1/0x

Actual behaviour
App crashes with text -
nvim: /home/travis/build/neovim/bot-ci/build/neovim/src/nvim/viml/parser/expressions.c:1241: viml_pexpr_handle_bop: Assertion `bop_node_lvl != new_top_node_lvl || bop_node_ass == new_top_node_ass' failed.

Expected behaviour
No crash, user can type more letters to finish expression.

Closing comment (2020-02-11T21:03:13Z): It looks similar to #7889, for which a PR exists (#8421).