To: vim-dev@vim.org Subject: Patch 5.8.004 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.8.004 Problem: When including a syntax cluster in itself, Vim crashes. (Timo Frenay) Solution: Restrict recursiveness of included clusters to 30. Files: src/syntax.c *** ../vim-5.8.003/src/syntax.c Mon Jun 4 22:16:15 2001 --- src/syntax.c Fri Jun 15 19:57:18 2001 *************** *** 4525,4530 **** --- 4525,4532 ---- int retval; short scl_id; short *scl_list; + static int depth = 0; + int r; /* * If list is ID_LIST_ALL, we are in a transparent item that isn't *************** *** 4559,4566 **** if (scl_id >= 0) { scl_list = SYN_CLSTR(syn_buf)[scl_id].scl_list; ! if (scl_list != NULL && in_id_list(scl_list, id, inctag, contained)) ! return retval; } } return !retval; --- 4561,4576 ---- if (scl_id >= 0) { scl_list = SYN_CLSTR(syn_buf)[scl_id].scl_list; ! /* restrict recursiveness to 30 to avoid an endless loop for a ! * cluster that includes itself (indirectly) */ ! if (scl_list != NULL && depth < 30) ! { ! ++depth; ! r = in_id_list(scl_list, id, inctag, contained); ! --depth; ! if (r) ! return retval; ! } } } return !retval; *** ../vim-5.8.003/src/version.c Fri Jun 15 19:59:13 2001 --- src/version.c Fri Jun 15 19:57:28 2001 *************** *** 439,440 **** --- 439,442 ---- { /* Add new patch number below this line */ + /**/ + 4, /**/ -- `When any government, or any church for that matter, undertakes to say to its subjects, "This you may not read, this you must not see, this you are forbidden to know," the end result is tyranny and oppression no matter how holy the motives' -- Robert A Heinlein, "If this goes on --" /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///