To: vim-dev@vim.org Subject: Patch 6.0.149 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.149 Problem: The pattern "\(.\{-}\)*" causes a hang. When using a search pattern that causes a stack overflow to be detected Vim could still hang. Solution: Correctly report "operand could be empty" when using "\{-}". Check for "out_of_stack" inside loops to avoid a hang. Files: src/regexp.c *** ../vim60.148/src/regexp.c Mon Nov 5 09:00:25 2001 --- src/regexp.c Tue Jan 22 17:39:43 2002 *************** *** 1305,1311 **** reginsert_limits(BRACE_LIMITS, minval, maxval, ret); ++num_complex_braces; } ! if (minval > 0) *flagp = (HASWIDTH | (flags & HASNL)); break; } --- 1305,1311 ---- reginsert_limits(BRACE_LIMITS, minval, maxval, ret); ++num_complex_braces; } ! if (minval > 0 && maxval > 0) *flagp = (HASWIDTH | (flags & HASNL)); break; } *************** *** 3083,3089 **** #endif while (scan != NULL) { ! if (got_int) return FALSE; #ifdef DEBUG if (regnarrate) --- 3083,3089 ---- #endif while (scan != NULL) { ! if (got_int || out_of_stack) return FALSE; #ifdef DEBUG if (regnarrate) *************** *** 3676,3682 **** reg_nextline(); ++clnum; ccol = 0; ! if (got_int) return FALSE; } --- 3676,3682 ---- reg_nextline(); ++clnum; ccol = 0; ! if (got_int || out_of_stack) return FALSE; } *************** *** 3906,3912 **** regline = reg_getline(reglnum); reginput = regline + STRLEN(regline); fast_breakcheck(); ! if (got_int) return FALSE; } else --- 3906,3912 ---- regline = reg_getline(reglnum); reginput = regline + STRLEN(regline); fast_breakcheck(); ! if (got_int || out_of_stack) return FALSE; } else *************** *** 3941,3947 **** || regrepeat(OPERAND(scan), 1L) == 0) break; ++count; ! if (got_int) return FALSE; } } --- 3941,3947 ---- || regrepeat(OPERAND(scan), 1L) == 0) break; ++count; ! if (got_int || out_of_stack) return FALSE; } } *** ../vim60.148/src/version.c Tue Jan 22 16:51:24 2002 --- src/version.c Tue Jan 22 17:35:49 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 149, /**/ -- A fine is a tax for doing wrong. A tax is a fine for doing well. /// 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 ///