changeset 1785:86d10d5d4915

Fix case where DMGrowBuf is growing backwards and needs to be reallocated in dmGrowBufRealloc() and the data is moved to the "end" of the newly grown buffer. Previously we used clrsize as data size, but that is (in retrospect) obviously incorrect. Use old buffer size instead.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 13 Jun 2018 01:39:06 +0300
parents a29d38862037
children 52e90130453b
files src/dmgrowbuf.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/dmgrowbuf.c	Wed Jun 13 01:37:36 2018 +0300
+++ b/src/dmgrowbuf.c	Wed Jun 13 01:39:06 2018 +0300
@@ -174,7 +174,7 @@
     DM_DBG("    clrsize=%" DM_PRIu_SIZE_T "\n", clrsize);
     if (buf->backwards)
     {
-        memmove(buf->data + clrsize, buf->data, clrsize);
+        memmove(buf->data + clrsize, buf->data, buf->size);
         buf->offs += clrsize;
     }