Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config parser segfault #529

Closed
nmeum opened this issue Nov 11, 2018 · 2 comments
Closed

Config parser segfault #529

nmeum opened this issue Nov 11, 2018 · 2 comments

Comments

@nmeum
Copy link
Contributor

nmeum commented Nov 11, 2018

Hi, thanks for writting this software. Just wanted to report a segfault I encountered while experiminting with it.

$ vimb --bug-info
Commit:          8f9e1b6
WebKit compile:  2.22.3
WebKit run:      2.22.3
GTK compile:     3.24.1
GTK run:         3.24.1
libsoup compile: 2.64.1
libsoup run:     2.64.1
Extension dir:   /usr/lib/vimb

Running on Alpine Linux Edge.

Steps to reproduce

$ echo "spell-checking-languages=en,de" > conf
$ vimb -c conf
Segmentation fault (core dumped)

Backtrace:

#0  0x00007fac4acb9650 in a_crash () at ./arch/x86_64/atomic_arch.h:108
#1  0x00007fac4acb9650 in __stack_chk_fail () at src/env/__stack_chk_fail.c:17
#2  0x0000557c1967ea45 in parse_command_name (c=c@entry=0x557c1b1bc160, input=input@entry=0x7ffcf09a48e0, arg=arg@entry=0x557c1b54ad80) at ex.c:674
#3  0x0000557c1967fc93 in parse (nohist=<synthetic pointer>, arg=0x557c1b54ad80, input=0x7ffcf09a48e0, c=0x557c1b1bc160) at ex.c:583
#4  0x0000557c1967fc93 in ex_run_string (c=c@entry=0x557c1b1bc160, input=input@entry=0x557c1b21eb60 "spell-checking-languages=en,de", enable_history=enable_history@entry=0) at ex.c:506
#5  0x0000557c196802fd in ex_run_file (c=0x557c1b1bc160, filename=0x557c1b1ae160 "/tmp/conf") at ex.c:485
#6  0x0000557c19675dca in main (argc=<optimized out>, argv=<optimized out>) at main.c:1977

Expected behaviour

The config file is invalid. The correct way to set spell checking languages is:

set spell-checking-languages=en,de

Nonetheless, vimb should output an error message instead of segfaulting.

Actual behaviour

vimb segfaults.

@fanglingsu
Copy link
Owner

@nmeum Thank you for reporting this issue. But I can't reproduce the segfault on my system. I get only the expected warning shown on cli and in the inputbox of vimb as "Unknown command: spell-checking-langu".

$ echo "spell-checking-languages=en,de" > conf
$ vimb -c conf                                
** (vimb:22564): WARNING **: 22:50:45.391: Invalid command in /home/daniel/conf: 'spell-checking-languages=en,de'

Apart from that segfault which should not happen the config in the file must be prefixed by set like we do for vim too. The right configuration should therefor be echo "set spell-checking-languages=en,de" > conf

@nmeum
Copy link
Contributor Author

nmeum commented Nov 11, 2018

Well…you have an off-by-one when accessing the cmd buffer in the parse_command function which causes a stack-based bufferflow and a segmentation fault on my platform. I will open a PR fixing this in a second.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants