Mercurial > vim
changeset 26262:2484d6d96166 v8.2.3662
patch 8.2.3662: illegal memory access if malloc() fails
Commit: https://github.com/vim/vim/commit/cf1e0239ceec96396fa51f494e442c799ccd45fb
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 24 15:13:26 2021 +0000
patch 8.2.3662: illegal memory access if malloc() fails
Problem: Illegal memory access if malloc() fails.
Solution: Check 'foldmethod' is not empty. (closes https://github.com/vim/vim/issues/9207)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 24 Nov 2021 16:15:03 +0100 |
parents | 4aee351f48a4 |
children | 96a2fb08d98a |
files | src/fold.c src/version.c |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fold.c +++ b/src/fold.c @@ -307,7 +307,7 @@ foldedCount(win_T *win, linenr_T lnum, f int foldmethodIsManual(win_T *wp) { - return (wp->w_p_fdm[3] == 'u'); + return (wp->w_p_fdm[0] != NUL && wp->w_p_fdm[3] == 'u'); } // foldmethodIsIndent() {{{2 @@ -327,7 +327,7 @@ foldmethodIsIndent(win_T *wp) int foldmethodIsExpr(win_T *wp) { - return (wp->w_p_fdm[1] == 'x'); + return (wp->w_p_fdm[0] != NUL && wp->w_p_fdm[1] == 'x'); } // foldmethodIsMarker() {{{2 @@ -337,7 +337,7 @@ foldmethodIsExpr(win_T *wp) int foldmethodIsMarker(win_T *wp) { - return (wp->w_p_fdm[2] == 'r'); + return (wp->w_p_fdm[0] != NUL && wp->w_p_fdm[2] == 'r'); } // foldmethodIsSyntax() {{{2