Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1919236 - null pointer dereference in do_arg_all() when input craft vimscript file
Summary: null pointer dereference in do_arg_all() when input craft vimscript file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: vim
Version: rawhide
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-22 12:27 UTC by 1vanChen
Modified: 2021-03-08 20:14 UTC (History)
3 users (show)

Fixed In Version: vim-8.2.2529-1.fc33 vim-8.2.2541-1.fc33 vim-8.2.2541-1.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-20 01:26:12 UTC
Type: Bug


Attachments (Terms of Use)
poc (284 bytes, application/octet-stream)
2021-01-22 12:27 UTC, 1vanChen
no flags Details
reduced poc file (25 bytes, application/octet-stream)
2021-01-26 06:23 UTC, 1vanChen
no flags Details

Description 1vanChen 2021-01-22 12:27:34 UTC
Created attachment 1749742 [details]
poc

To Reproduce

```shell
vim -u NONE -X -Z -e -s -S poc -c :qa!
```

Debug Info

```shell
/src/vim# gdb --args src/vim -u NONE -X -Z -e -s -S /mnt/disk/out/vim/vim-fuzzer-out/hAmWF0/crashes/id:000052,sig:11,src:059805+047186,op:splice,rep:2 -c :qa!                     
Program received signal SIGSEGV, Segmentation fault.
[----------------------------------registers-----------------------------------]
RAX: 0x0
RBX: 0x4
RCX: 0x0
RDX: 0x8e8948 --> 0x500000002
RSI: 0x2
RDI: 0x8fd1c0 --> 0x7ffff7690000 (MemError)
RBP: 0x0
RSP: 0x7fffffffaea0 --> 0x905281 --> 0x6c61 ('al')
RIP: 0x405eff (<ex_all+415>:    cmp    QWORD PTR [r12+0x88],0x0)
R8 : 0x0
R9 : 0x1
R10: 0x7ffff7fed700 (0x00007ffff7fed700)
R11: 0x0
R12: 0x0
R13: 0x905281 --> 0x6c61 ('al')
R14: 0x8f1090 --> 0x3e8
R15: 0x7fffffffaf28 --> 0x4d6d99 (<del_trailing_spaces+9>:      add    rax,rbx)
EFLAGS: 0x10206 (carry PARITY adjust zero sign trap INTERRUPT direction overflow)
[-------------------------------------code-------------------------------------]
   0x405ef2 <ex_all+402>:       mov    r12,QWORD PTR [r14+0x8]
   0x405ef6 <ex_all+406>:       mov    rax,QWORD PTR [r14+0x18]
   0x405efa <ex_all+410>:       mov    QWORD PTR [rsp+0x28],rax
=> 0x405eff <ex_all+415>:       cmp    QWORD PTR [r12+0x88],0x0
   0x405f08 <ex_all+424>:       je     0x405f28 <ex_all+456>
   0x405f0a <ex_all+426>:       cmp    ebx,0x83
   0x405f10 <ex_all+432>:       jne    0x405f20 <ex_all+448>
   0x405f12 <ex_all+434>:       test   esi,esi
[------------------------------------stack-------------------------------------]
0000| 0x7fffffffaea0 --> 0x905281 --> 0x6c61 ('al')
0008| 0x7fffffffaea8 --> 0x7fffffffafc0 --> 0x905281 --> 0x6c61 ('al')
0016| 0x7fffffffaeb0 --> 0x8e8948 --> 0x500000002
0024| 0x7fffffffaeb8 --> 0xffffafb0
0032| 0x7fffffffaec0 --> 0x0
0040| 0x7fffffffaec8 --> 0x0
0048| 0x7fffffffaed0 --> 0x0
0056| 0x7fffffffaed8 --> 0x0
[------------------------------------------------------------------------------]
Legend: code, data, rodata, value
Stopped reason: SIGSEGV
do_arg_all (count=0x270f, forceit=0x0, keep_tabs=<optimized out>) at arglist.c:927
927                 if (buf->b_ffname == NULL
gdb-peda$ bt
#0  do_arg_all (count=0x270f, forceit=0x0, keep_tabs=<optimized out>) at arglist.c:927
#1  ex_all (eap=<optimized out>) at arglist.c:1154
#2  0x000000000046897a in do_one_cmd (cmdlinep=0x7fffffffaf88, flags=0x7, cstack=0x7fffffffb168, fgetline=0x566f30 <getsourceline>, cookie=0x7fffffffb900) at ex_docmd.c:2588
#3  do_cmdline (cmdline=<optimized out>, cmdline@entry=0x904e50 "s9d{mct", fgetline=<optimized out>, cookie=<optimized out>, cookie@entry=0x7fffffffb900, flags=flags@entry=0x7) at ex_docmd.c:1003
#4  0x0000000000566d15 in do_source (fname=<optimized out>, fname@entry=0x8f8ef3 "/mnt/disk/out/vim/vim-fuzzer-out/hAmWF0/crashes/id:000052,sig:11,src:059805+047186,op:splice,rep:2",
    check_other=<optimized out>, check_other@entry=0x0, is_vimrc=is_vimrc@entry=0x0, ret_sid=<optimized out>, ret_sid@entry=0x0) at scriptfile.c:1401
#5  0x0000000000566489 in cmd_source (fname=0x8f8ef3 "/mnt/disk/out/vim/vim-fuzzer-out/hAmWF0/crashes/id:000052,sig:11,src:059805+047186,op:splice,rep:2", eap=<optimized out>) at scriptfile.c:971
#6  0x000000000046897a in do_one_cmd (cmdlinep=0x7fffffffb9f8, flags=0xb, cstack=0x7fffffffbbd8, fgetline=0x0, cookie=0x0) at ex_docmd.c:2588
#7  do_cmdline (cmdline=<optimized out>, fgetline=<optimized out>, fgetline@entry=0x0, cookie=<optimized out>, cookie@entry=0x0, flags=flags@entry=0xb) at ex_docmd.c:1003
#8  0x00000000004692de in do_cmdline_cmd (cmd=0x8fd1c0 "") at ex_docmd.c:592
#9  0x000000000062860d in exe_commands (parmp=<optimized out>) at main.c:3056
#10 vim_main2 () at main.c:760
#11 0x0000000000627772 in main (argc=<optimized out>, argc@entry=0xb, argv=<optimized out>, argv@entry=0x7fffffffe518) at main.c:412
#12 0x00007ffff72f7840 in __libc_start_main (main=0x625f40 <main>, argc=0xb, argv=0x7fffffffe518, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe508)
    at ../csu/libc-start.c:291
#13 0x0000000000404269 in _start ()
```



Environment:

- version : commit e2edc2ed4a9a229870b1e1811b0ecf045b84e429
- OS: Ubuntu 16.04



Additional context

compile argument:

```shell
#!/bin/bash -eux
export CC="clang-11"
export CXX="clang-11++"
cd /src/vim/ && ./configure --with-features=huge --enable-gui=none && make
```



Credit: 1vanChen of NSFOCUS Security Team

Comment 1 Zdenek Dohnal 2021-01-25 06:11:02 UTC
Hi,

thank you for reporting the issue!

I'll pass the issue to security team and report it upstream.

Comment 3 1vanChen 2021-01-26 06:23:20 UTC
Created attachment 1750772 [details]
reduced poc file

Simplified sample is provided

Comment 4 Mauro Matteo Cascella 2021-02-15 19:07:12 UTC
Please refer to https://bugzilla.redhat.com/show_bug.cgi?id=1919212#c4.

Comment 5 Fedora Update System 2021-02-18 09:34:08 UTC
FEDORA-2021-164265f25a has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-164265f25a

Comment 6 Fedora Update System 2021-02-18 09:34:53 UTC
FEDORA-2021-01b3981cc5 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-01b3981cc5

Comment 7 Fedora Update System 2021-02-19 02:00:01 UTC
FEDORA-2021-01b3981cc5 has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-01b3981cc5`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-01b3981cc5

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2021-02-19 02:03:57 UTC
FEDORA-2021-164265f25a has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-164265f25a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-164265f25a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2021-02-20 01:26:12 UTC
FEDORA-2021-164265f25a has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2021-02-22 07:45:33 UTC
FEDORA-2021-5be90ab004 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-5be90ab004

Comment 11 Fedora Update System 2021-02-22 08:02:58 UTC
FEDORA-2021-fb090f432a has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-fb090f432a

Comment 12 Fedora Update System 2021-02-24 21:39:57 UTC
FEDORA-2021-fb090f432a has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-fb090f432a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-fb090f432a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2021-02-24 21:55:18 UTC
FEDORA-2021-5be90ab004 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-5be90ab004`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-5be90ab004

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2021-02-26 01:09:18 UTC
FEDORA-2021-5be90ab004 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 15 Fedora Update System 2021-03-08 20:14:02 UTC
FEDORA-2021-fb090f432a has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.