Mercurial > vim
changeset 6989:c0a23e04c929 v7.4.812
patch 7.4.812
Problem: Gcc sanitizer complains about using a NULL pointer to memmove().
Solution: Only call memmove when there is something to move. (Vittorio
Zecca)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 08 Aug 2015 18:23:46 +0200 |
parents | e86ada5d3fa0 |
children | 9c248be4e7d2 |
files | src/memline.c src/version.c |
diffstat | 2 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/memline.c +++ b/src/memline.c @@ -3834,7 +3834,8 @@ ml_add_stack(buf) (buf->b_ml.ml_stack_size + STACK_INCR)); if (newstack == NULL) return -1; - mch_memmove(newstack, buf->b_ml.ml_stack, + if (top > 0) + mch_memmove(newstack, buf->b_ml.ml_stack, (size_t)top * sizeof(infoptr_T)); vim_free(buf->b_ml.ml_stack); buf->b_ml.ml_stack = newstack;