diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-12-02 09:55:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-02 09:55:11 +0800 |
commit | 387c5ba3de356ea5c5f6fe71465440abd8563d8e (patch) | |
tree | bcf8d4304c451970b53acb2c73a164b6e4a94113 /test/functional/vimscript/eval_spec.lua | |
parent | fedbf32250ba303ee06c751e798c28c5a3f05862 (diff) | |
download | rneovim-387c5ba3de356ea5c5f6fe71465440abd8563d8e.tar.gz rneovim-387c5ba3de356ea5c5f6fe71465440abd8563d8e.tar.bz2 rneovim-387c5ba3de356ea5c5f6fe71465440abd8563d8e.zip |
revert: "memory: Free buffers after freeing variables" (#26356)
This reverts commit fe30d8ccef17fff23676b8670dfec86444e2cb32.
The original commit intends to prevent heap-use-after-free with EXITFREE
caused by changedtick_di, which is no longer a problem.
Freeing buffers after freeing variables will cause heap-use-after-free
with EXITFREE when a partial is used as prompt callback.
Diffstat (limited to 'test/functional/vimscript/eval_spec.lua')
-rw-r--r-- | test/functional/vimscript/eval_spec.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/functional/vimscript/eval_spec.lua b/test/functional/vimscript/eval_spec.lua index ab0ffccd4d..196e303738 100644 --- a/test/functional/vimscript/eval_spec.lua +++ b/test/functional/vimscript/eval_spec.lua @@ -15,6 +15,7 @@ local Screen = require('test.functional.ui.screen') local mkdir = helpers.mkdir local clear = helpers.clear local eq = helpers.eq +local exec = helpers.exec local exc_exec = helpers.exc_exec local exec_lua = helpers.exec_lua local exec_capture = helpers.exec_capture @@ -28,6 +29,7 @@ local pcall_err = helpers.pcall_err local assert_alive = helpers.assert_alive local poke_eventloop = helpers.poke_eventloop local feed = helpers.feed +local expect_exit = helpers.expect_exit describe('Up to MAX_FUNC_ARGS arguments are handled by', function() local max_func_args = 20 -- from eval.h @@ -312,3 +314,14 @@ it('no double-free in garbage collection #16287', function() sleep(10) assert_alive() end) + +it('no heap-use-after-free with EXITFREE and partial as prompt callback', function() + clear() + exec([[ + func PromptCallback(text) + endfunc + setlocal buftype=prompt + call prompt_setcallback('', funcref('PromptCallback')) + ]]) + expect_exit(command, 'qall!') +end) |