Mercurial > vim
comparison src/quickfix.c @ 13076:7c071a3f7f8e v8.0.1413
patch 8.0.1413: accessing freed memory in :cbuffer
commit https://github.com/vim/vim/commit/aaf6e43b7a99cedb89d73ba749a46f7a0f16bbb6
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 19 16:41:14 2017 +0100
patch 8.0.1413: accessing freed memory in :cbuffer
Problem: Accessing freed memory in :cbuffer.
Solution: Get quickfix list after executing autocmds. (closes https://github.com/vim/vim/issues/2470)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 19 Dec 2017 16:45:06 +0100 |
parents | 66c014c71dad |
children | a1f8939a4644 |
comparison
equal
deleted
inserted
replaced
13075:d25c0dfb3ec6 | 13076:7c071a3f7f8e |
---|---|
5518 #ifdef FEAT_AUTOCMD | 5518 #ifdef FEAT_AUTOCMD |
5519 char_u *au_name = NULL; | 5519 char_u *au_name = NULL; |
5520 #endif | 5520 #endif |
5521 int res; | 5521 int res; |
5522 | 5522 |
5523 if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer | |
5524 || eap->cmdidx == CMD_laddbuffer) | |
5525 { | |
5526 qi = ll_get_or_alloc_list(curwin); | |
5527 if (qi == NULL) | |
5528 return; | |
5529 } | |
5530 | |
5531 #ifdef FEAT_AUTOCMD | 5523 #ifdef FEAT_AUTOCMD |
5532 switch (eap->cmdidx) | 5524 switch (eap->cmdidx) |
5533 { | 5525 { |
5534 case CMD_cbuffer: au_name = (char_u *)"cbuffer"; break; | 5526 case CMD_cbuffer: au_name = (char_u *)"cbuffer"; break; |
5535 case CMD_cgetbuffer: au_name = (char_u *)"cgetbuffer"; break; | 5527 case CMD_cgetbuffer: au_name = (char_u *)"cgetbuffer"; break; |
5546 if (aborting()) | 5538 if (aborting()) |
5547 return; | 5539 return; |
5548 # endif | 5540 # endif |
5549 } | 5541 } |
5550 #endif | 5542 #endif |
5543 | |
5544 /* Must come after autocommands. */ | |
5545 if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer | |
5546 || eap->cmdidx == CMD_laddbuffer) | |
5547 { | |
5548 qi = ll_get_or_alloc_list(curwin); | |
5549 if (qi == NULL) | |
5550 return; | |
5551 } | |
5551 | 5552 |
5552 if (*eap->arg == NUL) | 5553 if (*eap->arg == NUL) |
5553 buf = curbuf; | 5554 buf = curbuf; |
5554 else if (*skipwhite(skipdigits(eap->arg)) == NUL) | 5555 else if (*skipwhite(skipdigits(eap->arg)) == NUL) |
5555 buf = buflist_findnr(atoi((char *)eap->arg)); | 5556 buf = buflist_findnr(atoi((char *)eap->arg)); |