Headline
CVE-2022-2289: patch 9.0.0026: accessing freed memory with diff put · vim/vim@c5274dd
Use After Free in GitHub repository vim/vim prior to 9.0.
@@ -2642,6 +2642,20 @@ nv_diffgetput(int put, long count) ex_diffgetput(&ea); }
/* * Return TRUE if “diff” appears in the list of diff blocks of the current tab. */ static int valid_diff(diff_T *diff) { diff_T *dp;
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next) if (dp == diff) return TRUE; return FALSE; }
/* * “:diffget” * “:diffput” @@ -2899,9 +2913,9 @@ ex_diffgetput(exarg_T *eap) } }
// Adjust marks. This will change the following entries! if (added != 0) { // Adjust marks. This will change the following entries! mark_adjust(lnum, lnum + count - 1, (long)MAXLNUM, (long)added); if (curwin->w_cursor.lnum >= lnum) { @@ -2923,7 +2937,13 @@ ex_diffgetput(exarg_T *eap) #endif vim_free(dfree); } else
// mark_adjust() may have made “dp” invalid. We don’t know where // to continue then, bail out. if (added != 0 && !valid_diff(dp)) break;
if (dfree == NULL) // mark_adjust() may have changed the count in a wrong way dp->df_count[idx_to] = new_count;
Related news
Ubuntu Security Notice 6270-1 - It was discovered that Vim incorrectly handled memory when opening certain files. If an attacker could trick a user into opening a specially crafted file, it could cause Vim to crash, or possibly execute arbitrary code. This issue only affected Ubuntu 22.04 LTS. It was discovered that Vim incorrectly handled memory when deleting buffers in diff mode. An attacker could possibly use this issue to cause a denial of service. This issue only affected Ubuntu 20.04 LTS and Ubuntu 22.04 LTS.
Gentoo Linux Security Advisory 202305-16 - Multiple vulnerabilities have been found in Vim, the worst of which could result in denial of service. Versions less than 9.0.1157 are affected.
Hello everyone! Great news for my open source Scanvus project! You can now perform vulnerability checks on Linux hosts and docker images not only using the Vulners.com API, but also with the Vulns.io VM API. It’s especially nice that all the code to support the new API was written and contributed by colleagues from Vulns.io. […]
Gentoo Linux Security Advisory 202208-32 - Multiple vulnerabilities have been discovered in Vim, the worst of which could result in denial of service. Versions less than 9.0.0060 are affected.