To: vim_dev@googlegroups.com Subject: Patch 8.1.2100 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2200 Problem: Crash when memory allocation fails. Solution: Check for NULL curwin and curbuf. (Christian Brabandt, closes #4839) Files: src/getchar.c *** ../vim-8.1.2199/src/getchar.c 2019-10-20 16:00:44.461152749 +0200 --- src/getchar.c 2019-10-22 21:53:52.789438279 +0200 *************** *** 2059,2066 **** void parse_queued_messages(void) { ! int old_curwin_id = curwin->w_id; ! int old_curbuf_fnum = curbuf->b_fnum; int i; int save_may_garbage_collect = may_garbage_collect; static int entered = 0; --- 2059,2066 ---- void parse_queued_messages(void) { ! int old_curwin_id; ! int old_curbuf_fnum; int i; int save_may_garbage_collect = may_garbage_collect; static int entered = 0; *************** *** 2071,2076 **** --- 2071,2084 ---- if (updating_screen) return; + // If memory allocation fails during startup we'll exit but curbuf or + // curwin could be NULL. + if (curbuf == NULL || curwin == NULL) + return; + + old_curbuf_fnum = curbuf->b_fnum; + old_curwin_id = curwin->w_id; + ++entered; // may_garbage_collect is set in main_loop() to do garbage collection when *** ../vim-8.1.2199/src/version.c 2019-10-22 21:45:15.950716560 +0200 --- src/version.c 2019-10-22 21:54:13.253374963 +0200 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2200, /**/ -- DENNIS: Look, strange women lying on their backs in ponds handing out swords ... that's no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///