Mercurial > vim
changeset 15265:a7d02a56b5d5 v8.1.0641
patch 8.1.0641: no check for out-of-memory when converting regexp
commit https://github.com/vim/vim/commit/c57463c9c6ee893285f553e0ac3b2fe5935f16b8
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Dec 26 22:04:41 2018 +0100
patch 8.1.0641: no check for out-of-memory when converting regexp
Problem: No check for out-of-memory when converting regexp.
Solution: Bail out when lalloc() returns NULL. (John Marriott)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 26 Dec 2018 22:15:05 +0100 |
parents | ac8b7be7e2fa |
children | f4d28214c3d3 |
files | src/regexp_nfa.c src/version.c |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -3218,8 +3218,10 @@ post2nfa(int *postfix, int *end, int nfa if (nfa_calc_size == FALSE) { - /* Allocate space for the stack. Max states on the stack : nstate */ + // Allocate space for the stack. Max states on the stack: "nstate'. stack = (Frag_T *)lalloc((nstate + 1) * sizeof(Frag_T), TRUE); + if (stack == NULL) + return NULL; stackp = stack; stack_end = stack + (nstate + 1); }