Mercurial > vim
diff src/memline.c @ 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 | 62ba356c2d4e |
children | 1886f2863437 |
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;