To: vim_dev@googlegroups.com Subject: Patch 7.4.975 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.975 Problem: Using ":sort" on a very big file sometimes causes text to be corrupted. (John Beckett) Solution: Copy the line into a buffer before calling ml_append(). Files: src/ex_cmds.c *** ../vim-7.4.974/src/ex_cmds.c 2015-11-10 21:05:45.309028557 +0100 --- src/ex_cmds.c 2015-12-17 13:00:53.896995875 +0100 *************** *** 540,549 **** if (!unique || i == 0 || (sort_ic ? STRICMP(s, sortbuf1) : STRCMP(s, sortbuf1)) != 0) { ! if (ml_append(lnum++, s, (colnr_T)0, FALSE) == FAIL) break; - if (unique) - STRCPY(sortbuf1, s); } fast_breakcheck(); if (got_int) --- 540,550 ---- if (!unique || i == 0 || (sort_ic ? STRICMP(s, sortbuf1) : STRCMP(s, sortbuf1)) != 0) { ! /* Copy the line into a buffer, it may become invalid in ! * ml_append(). And it's needed for "unique". */ ! STRCPY(sortbuf1, s); ! if (ml_append(lnum++, sortbuf1, (colnr_T)0, FALSE) == FAIL) break; } fast_breakcheck(); if (got_int) *** ../vim-7.4.974/src/version.c 2015-12-17 15:03:51.303857910 +0100 --- src/version.c 2015-12-17 15:06:00.974494673 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 975, /**/ -- Life would be so much easier if we could just look at the source code. /// 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 ///