Mercurial > vim
comparison src/ex_cmds.c @ 16686:6ea3f93b4428 v8.1.1345
patch 8.1.1345: stuck in sandbox with ":s/../=Function/gn"
commit https://github.com/vim/vim/commit/6349e9411fd17f80c7aff9c678a8800647d34cfa
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 18 13:41:22 2019 +0200
patch 8.1.1345: stuck in sandbox with ":s/../\=Function/gn"
Problem: Stuck in sandbox with ":s/../\=Function/gn".
Solution: Don't skip over code to restore sandbox. (Christian Brabandt)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 18 May 2019 13:45:04 +0200 |
parents | 1fc9cd08cf3c |
children | 23af483c4ceb |
comparison
equal
deleted
inserted
replaced
16685:8afb13c6a0d9 | 16686:6ea3f93b4428 |
---|---|
5553 * 3. substitute the string. | 5553 * 3. substitute the string. |
5554 */ | 5554 */ |
5555 #ifdef FEAT_EVAL | 5555 #ifdef FEAT_EVAL |
5556 if (subflags.do_count) | 5556 if (subflags.do_count) |
5557 { | 5557 { |
5558 /* prevent accidentally changing the buffer by a function */ | 5558 // prevent accidentally changing the buffer by a function |
5559 save_ma = curbuf->b_p_ma; | |
5560 curbuf->b_p_ma = FALSE; | 5559 curbuf->b_p_ma = FALSE; |
5561 sandbox++; | 5560 sandbox++; |
5562 } | 5561 } |
5563 /* Save flags for recursion. They can change for e.g. | 5562 // Save flags for recursion. They can change for e.g. |
5564 * :s/^/\=execute("s#^##gn") */ | 5563 // :s/^/\=execute("s#^##gn") |
5565 subflags_save = subflags; | 5564 subflags_save = subflags; |
5566 #endif | 5565 save_ma = curbuf->b_p_ma; |
5567 /* get length of substitution part */ | 5566 #endif |
5567 // get length of substitution part | |
5568 sublen = vim_regsub_multi(®match, | 5568 sublen = vim_regsub_multi(®match, |
5569 sub_firstlnum - regmatch.startpos[0].lnum, | 5569 sub_firstlnum - regmatch.startpos[0].lnum, |
5570 sub, sub_firstline, FALSE, p_magic, TRUE); | 5570 sub, sub_firstline, FALSE, p_magic, TRUE); |
5571 #ifdef FEAT_EVAL | 5571 #ifdef FEAT_EVAL |
5572 // If getting the substitute string caused an error, don't do | 5572 // If getting the substitute string caused an error, don't do |
5573 // the replacement. | 5573 // the replacement. |
5574 if (aborting()) | |
5575 goto skip; | |
5576 | |
5577 // Don't keep flags set by a recursive call. | 5574 // Don't keep flags set by a recursive call. |
5578 subflags = subflags_save; | 5575 subflags = subflags_save; |
5579 if (subflags.do_count) | 5576 if (aborting() || subflags.do_count) |
5580 { | 5577 { |
5581 curbuf->b_p_ma = save_ma; | 5578 curbuf->b_p_ma = save_ma; |
5582 if (sandbox > 0) | 5579 if (sandbox > 0) |
5583 sandbox--; | 5580 sandbox--; |
5584 goto skip; | 5581 goto skip; |