Bram Moolenaar wrote: > Dominique Pelle wrote: > >> Vim-7.2.108 can read and write beyond allocated memory when >> using autocmd VimResized. Bug happens if a shell command is >> used in VimResized autocmd such as... >> >> :au! VimResized * sil !echo -ne "\033]12;green\007" >> >> With this autocmd, I observe the following error with valgrind >> when resizing the screen with the mouse:
...snip... > Thanks. Not sure if the solution is OK, will have to check that. > What if the autocommand relies on the screen already being allocated? > This is tricky stuff. I think it's OK, but it's tricky as you say. An alternative way to fix it, is to check, after applying the autocmd, whether Rows or Columns have changed as a result of applying the autocmds, and if so (which is rare) then re-allocate the screen again before returning from screenalloc(). The new attached patch does just that. Of course, there might be a risk of endless loop if an autocmd changed Rows and Columns every time. So the patch puts a guard to avoid re-allocating screen more than 3 times. In practice, I observe that it's reallocating sometimes once, rarely twice and I do no see more than that. Both patches fix the errors that I see with valgrind. Regards -- Dominique --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
fix-VimResized-screen.c.patch2
Description: Binary data
