diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-24 20:07:22 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-24 20:07:22 +0100 |
commit | d6c67629ed05aae436164eec474832daf8ba7420 (patch) | |
tree | 7a2edf894153bc5e71d0213a7501ff858941b467 /src/quickfix.c | |
parent | 80525751c5ce9ed82c41d83faf9ef38667bf61b1 (diff) | |
download | vim-git-d6c67629ed05aae436164eec474832daf8ba7420.tar.gz |
patch 9.0.0260: using freed memory when using 'quickfixtextfunc' recursivelyv9.0.0260
Problem: Using freed memory when using 'quickfixtextfunc' recursively.
Solution: Do not allow for recursion.
Diffstat (limited to 'src/quickfix.c')
-rw-r--r-- | src/quickfix.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/quickfix.c b/src/quickfix.c index 54ae07df5..6af62e8df 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -4674,6 +4674,11 @@ call_qftf_func(qf_list_T *qfl, int qf_winid, long start_idx, long end_idx) { callback_T *cb = &qftf_cb; list_T *qftf_list = NULL; + static int recursive = FALSE; + + if (recursive) + return NULL; // this doesn't work properly recursively + recursive = TRUE; // If 'quickfixtextfunc' is set, then use the user-supplied function to get // the text to display. Use the local value of 'quickfixtextfunc' if it is @@ -4688,7 +4693,10 @@ call_qftf_func(qf_list_T *qfl, int qf_winid, long start_idx, long end_idx) // create the dict argument if ((d = dict_alloc_lock(VAR_FIXED)) == NULL) + { + recursive = FALSE; return NULL; + } dict_add_number(d, "quickfix", (long)IS_QF_LIST(qfl)); dict_add_number(d, "winid", (long)qf_winid); dict_add_number(d, "id", (long)qfl->qf_id); @@ -4711,6 +4719,7 @@ call_qftf_func(qf_list_T *qfl, int qf_winid, long start_idx, long end_idx) dict_unref(d); } + recursive = FALSE; return qftf_list; } |