To: vim_dev@googlegroups.com Subject: Patch 8.2.4688 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4688 Problem: New regexp engine does not give an error for "\%v". Solution: Check for a value argument. (issue #10079) Files: src/regexp_nfa.c, src/errors.h, src/regexp_bt.c, src/testdir/test_regexp_latin.vim *** ../vim-8.2.4687/src/regexp_nfa.c 2022-03-30 10:57:36.735346197 +0100 --- src/regexp_nfa.c 2022-04-04 18:13:02.941458492 +0100 *************** *** 1654,1660 **** if (cur) { ! semsg(_(e_regexp_number_after_dot_pos_search), no_Magic(c)); return FAIL; } --- 1654,1660 ---- if (cur) { ! semsg(_(e_regexp_number_after_dot_pos_search_chr), no_Magic(c)); return FAIL; } *************** *** 1673,1678 **** --- 1673,1684 ---- { long_u limit = INT_MAX; + if (!cur && n == 0) + { + semsg(_(e_nfa_regexp_missing_value_in_chr), + no_Magic(c)); + return FAIL; + } if (c == 'l') { if (cur) *** ../vim-8.2.4687/src/errors.h 2022-03-31 11:37:54.259367941 +0100 --- src/errors.h 2022-04-04 18:11:37.281351373 +0100 *************** *** 3082,3088 **** EXTERN char e_dot_can_only_be_used_on_dictionary_str[] INIT(= N_("E1203: Dot can only be used on a dictionary: %s")); #endif ! EXTERN char e_regexp_number_after_dot_pos_search[] INIT(= N_("E1204: No Number allowed after .: '\\%%%c'")); EXTERN char e_no_white_space_allowed_between_option_and[] INIT(= N_("E1205: No white space allowed between option and")); --- 3082,3088 ---- EXTERN char e_dot_can_only_be_used_on_dictionary_str[] INIT(= N_("E1203: Dot can only be used on a dictionary: %s")); #endif ! EXTERN char e_regexp_number_after_dot_pos_search_chr[] INIT(= N_("E1204: No Number allowed after .: '\\%%%c'")); EXTERN char e_no_white_space_allowed_between_option_and[] INIT(= N_("E1205: No white space allowed between option and")); *************** *** 3256,3258 **** --- 3256,3260 ---- EXTERN char e_using_type_not_in_script_context_str[] INIT(= N_("E1272: Using type not in a script context: %s")); #endif + EXTERN char e_nfa_regexp_missing_value_in_chr[] + INIT(= N_("E1273: (NFA regexp) missing value in '\\%%%c'")); *** ../vim-8.2.4687/src/regexp_bt.c 2022-03-29 13:24:49.195974887 +0100 --- src/regexp_bt.c 2022-04-04 18:12:52.389446557 +0100 *************** *** 1649,1655 **** { if (cur && n) { ! semsg(_(e_regexp_number_after_dot_pos_search), no_Magic(c)); rc_did_emsg = TRUE; return NULL; } --- 1649,1656 ---- { if (cur && n) { ! semsg(_(e_regexp_number_after_dot_pos_search_chr), ! no_Magic(c)); rc_did_emsg = TRUE; return NULL; } *** ../vim-8.2.4687/src/testdir/test_regexp_latin.vim 2022-03-29 13:24:49.195974887 +0100 --- src/testdir/test_regexp_latin.vim 2022-04-04 18:31:30.673685137 +0100 *************** *** 91,96 **** --- 91,108 ---- set re=0 endfunc + func Test_column_failure() + set re=1 + call assert_fails('/\%v', 'E71:') + call assert_fails('/\%c', 'E71:') + call assert_fails('/\%l', 'E71:') + set re=2 + call assert_fails('/\%v', 'E1273:') + call assert_fails('/\%c', 'E1273:') + call assert_fails('/\%l', 'E1273:') + set re=0 + endfunc + func Test_recursive_addstate() " This will call addstate() recursively until it runs into the limit. let lnum = search('\v((){328}){389}') *** ../vim-8.2.4687/src/version.c 2022-04-04 18:14:30.237544867 +0100 --- src/version.c 2022-04-04 18:31:48.001680800 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4688, /**/ -- Any sufficiently advanced technology is indistinguishable from magic. Arthur C. Clarke Any sufficiently advanced bug is indistinguishable from a feature. Rich Kulawiec /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///