Mercurial > vim
comparison src/vim9cmds.c @ 32064:6f8840c8acb3 v9.0.1363
patch 9.0.1363: crash when :def function has :break in skipped block
Commit: https://github.com/vim/vim/commit/3f45d67a150f934ab819c3739cf189a0e2c9545c
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 27 22:06:51 2023 +0000
patch 9.0.1363: crash when :def function has :break in skipped block
Problem: Crash when :def function has :break in skipped block. (Ernie Rael)
Solution: Don't generate a jump for a skipped :break. (closes https://github.com/vim/vim/issues/12077)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 27 Feb 2023 23:15:03 +0100 |
parents | 7d505d77f6da |
children | c1f730c2b51e |
comparison
equal
deleted
inserted
replaced
32063:b11f2c5c3978 | 32064:6f8840c8acb3 |
---|---|
1438 | 1438 |
1439 if (compile_find_scope(NULL, &el, &try_scopes, | 1439 if (compile_find_scope(NULL, &el, &try_scopes, |
1440 e_break_without_while_or_for, cctx) == FAIL) | 1440 e_break_without_while_or_for, cctx) == FAIL) |
1441 return NULL; | 1441 return NULL; |
1442 | 1442 |
1443 if (cctx->ctx_skip == SKIP_YES) | |
1444 return arg; | |
1445 | |
1443 if (try_scopes > 0) | 1446 if (try_scopes > 0) |
1444 // Inside one or more try/catch blocks we first need to jump to the | 1447 // Inside one or more try/catch blocks we first need to jump to the |
1445 // "finally" or "endtry" to cleanup. Then come to the next JUMP | 1448 // "finally" or "endtry" to cleanup. Then come to the next JUMP |
1446 // instruction, which we don't know the index of yet. | 1449 // instruction, which we don't know the index of yet. |
1447 generate_TRYCONT(cctx, try_scopes, cctx->ctx_instr.ga_len + 1); | 1450 generate_TRYCONT(cctx, try_scopes, cctx->ctx_instr.ga_len + 1); |
1448 | 1451 |
1449 // Jump to the end of the FOR or WHILE loop. The instruction index will be | 1452 // Jump to the end of the FOR or WHILE loop. The instruction index will be |
1450 // filled in later. | 1453 // filled in later. |
1451 if (compile_jump_to_end(el, JUMP_ALWAYS, 0, cctx) == FAIL) | 1454 if (compile_jump_to_end(el, JUMP_ALWAYS, 0, cctx) == FAIL) |
1452 return FAIL; | 1455 return NULL; |
1453 | 1456 |
1454 return arg; | 1457 return arg; |
1455 } | 1458 } |
1456 | 1459 |
1457 /* | 1460 /* |