]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0618: use-after-free in popup_getoptions() on dict_add() failure v9.2.0618
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Wed, 10 Jun 2026 20:55:06 +0000 (20:55 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 10 Jun 2026 20:55:06 +0000 (20:55 +0000)
Problem:  use-after-free in popup_getoptions() on dict_add() failure
Solution: Set b to NULL (Yasuhiro Matsumoto).

When dict_add() failed, dictitem_free() unref'd and freed the blob, but
the error cleanup then read the freed blob's refcount and could free it
again. Clear the pointer after dictitem_free().

closes: #20464

Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/popupwin.c
src/version.c

index 7610ae538a065297f44ba7a1d53262800c714434..351c8655681123ef806bac79be54017daebac4f4 100644 (file)
@@ -5433,7 +5433,9 @@ f_popup_getoptions(typval_T *argvars, typval_T *rettv)
                ++b->bv_refcount;
                if (dict_add(idict, item) == FAIL)
                {
+                   // dictitem_free() already freed the blob
                    dictitem_free(item);
+                   b = NULL;
                    ok = FALSE;
                }
            }
index e100c8a4b1e35a4d00e30f9d8ac9a348d64ab583..8d6afb613b24be73ecf9b627cd20ee6ff7f044b1 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    618,
 /**/
     617,
 /**/