Mercurial > vim
comparison src/vim9execute.c @ 27565:0b12dd90a5d6 v8.2.4309
patch 8.2.4309: Vim9: crash when using a partial in the wrong context
Commit: https://github.com/vim/vim/commit/fe1bfc9b267fffedac6b5224d7aa6cc5d9d15f64
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 6 13:55:03 2022 +0000
patch 8.2.4309: Vim9: crash when using a partial in the wrong context
Problem: Vim9: crash when using a partial in the wrong context.
Solution: Don't use an NULL outer pointer. (closes https://github.com/vim/vim/issues/9706)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 06 Feb 2022 15:00:03 +0100 |
parents | f00a7a2bee21 |
children | a31dd0a3cb39 |
comparison
equal
deleted
inserted
replaced
27564:b7040a16ebb1 | 27565:0b12dd90a5d6 |
---|---|
1692 if (end_lnum > iptr->isn_lnum) | 1692 if (end_lnum > iptr->isn_lnum) |
1693 vim_free(line); | 1693 vim_free(line); |
1694 } | 1694 } |
1695 | 1695 |
1696 /* | 1696 /* |
1697 * Store a value in a list or dict variable. | 1697 * Store a value in a list, dict or blob variable. |
1698 * Returns OK, FAIL or NOTDONE (uncatchable error). | 1698 * Returns OK, FAIL or NOTDONE (uncatchable error). |
1699 */ | 1699 */ |
1700 static int | 1700 static int |
1701 execute_storeindex(isn_T *iptr, ectx_T *ectx) | 1701 execute_storeindex(isn_T *iptr, ectx_T *ectx) |
1702 { | 1702 { |
5079 ectx.ec_outer_ref = ALLOC_CLEAR_ONE(outer_ref_T); | 5079 ectx.ec_outer_ref = ALLOC_CLEAR_ONE(outer_ref_T); |
5080 if (ectx.ec_outer_ref == NULL) | 5080 if (ectx.ec_outer_ref == NULL) |
5081 goto failed_early; | 5081 goto failed_early; |
5082 if (partial != NULL) | 5082 if (partial != NULL) |
5083 { | 5083 { |
5084 if (partial->pt_outer.out_stack == NULL && current_ectx != NULL) | 5084 if (partial->pt_outer.out_stack == NULL) |
5085 { | 5085 { |
5086 if (current_ectx->ec_outer_ref != NULL | 5086 if (current_ectx != NULL) |
5087 && current_ectx->ec_outer_ref->or_outer != NULL) | 5087 { |
5088 ectx.ec_outer_ref->or_outer = | 5088 if (current_ectx->ec_outer_ref != NULL |
5089 && current_ectx->ec_outer_ref->or_outer != NULL) | |
5090 ectx.ec_outer_ref->or_outer = | |
5089 current_ectx->ec_outer_ref->or_outer; | 5091 current_ectx->ec_outer_ref->or_outer; |
5092 } | |
5093 // Should there be an error here? | |
5090 } | 5094 } |
5091 else | 5095 else |
5092 { | 5096 { |
5093 ectx.ec_outer_ref->or_outer = &partial->pt_outer; | 5097 ectx.ec_outer_ref->or_outer = &partial->pt_outer; |
5094 ++partial->pt_refcount; | 5098 ++partial->pt_refcount; |