To: vim-dev@vim.org Subject: Patch 6.2.480 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.480 Problem: NetBeans: Using negative index in array. backslash at end of message may cause Vim to crash. (Xavier de Gaye) Solution: Initialize buf_list_used to zero. Check for trailing backslash. Files: src/netbeans.c *** ../vim-6.2.479/src/netbeans.c Thu Feb 19 14:43:37 2004 --- src/netbeans.c Sat Apr 17 21:00:04 2004 *************** *** 833,840 **** typedef struct nbbuf_struct nbbuf_T; static nbbuf_T *buf_list = 0; ! int buf_list_size = 0; ! int buf_list_used = -1; /* last index in use */ static char **globalsignmap; static int globalsignmaplen; --- 833,840 ---- typedef struct nbbuf_struct nbbuf_T; static nbbuf_T *buf_list = 0; ! int buf_list_size = 0; /* size of buf_list */ ! int buf_list_used = 0; /* nr of entries in buf_list actually in use */ static char **globalsignmap; static int globalsignmaplen; *************** *** 855,866 **** { int i; ! for (i = 0; i <= buf_list_used; i++) ! { if (buf_list[i].bufp == bufp) return i; - } - return -1; } --- 855,863 ---- { int i; ! for (i = 0; i < buf_list_used; i++) if (buf_list[i].bufp == bufp) return i; return -1; } *************** *** 913,930 **** buf_list = (nbbuf_T *)alloc_clear(100 * sizeof(nbbuf_T)); buf_list_size = 100; } ! if (bufno > buf_list_used) /* new */ { if (bufno >= buf_list_size) /* grow list */ { ! incr = 100; buf_list_size += incr; buf_list = (nbbuf_T *)vim_realloc( ! buf_list, buf_list_size * sizeof(nbbuf_T)); memset(buf_list + buf_list_size - incr, 0, incr * sizeof(nbbuf_T)); } ! while (buf_list_used < bufno) { /* Default is to fire text changes. */ buf_list[buf_list_used].fireChanges = 1; --- 910,927 ---- buf_list = (nbbuf_T *)alloc_clear(100 * sizeof(nbbuf_T)); buf_list_size = 100; } ! if (bufno >= buf_list_used) /* new */ { if (bufno >= buf_list_size) /* grow list */ { ! incr = bufno - buf_list_size + 90; buf_list_size += incr; buf_list = (nbbuf_T *)vim_realloc( ! buf_list, buf_list_size * sizeof(nbbuf_T)); memset(buf_list + buf_list_size - incr, 0, incr * sizeof(nbbuf_T)); } ! while (buf_list_used <= bufno) { /* Default is to fire text changes. */ buf_list[buf_list_used].fireChanges = 1; *************** *** 963,969 **** if (!haveConnection) return; ! for (i = 0; i <= buf_list_used; i++) { if (!buf_list[i].bufp) continue; --- 960,966 ---- if (!haveConnection) return; ! for (i = 0; i < buf_list_used; i++) { if (!buf_list[i].bufp) continue; *************** *** 1156,1161 **** --- 1153,1160 ---- case 't': *q++ = '\t'; break; case 'r': *q++ = '\r'; break; case '"': *q++ = '"'; break; + case NUL: --p; break; + /* default: skip over illegal chars */ } ++p; break; *** ../vim-6.2.479/src/version.c Fri Apr 16 22:03:45 2004 --- src/version.c Sat Apr 17 21:12:14 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 480, /**/ -- "I know that there are people who don't love their fellow man, and I hate those people!" - Tom Lehrer /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///