diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-09-20 16:51:03 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-09-20 16:53:42 +0100 |
commit | cf371385d50ea718e8af8bb18f2fce28690a46c4 (patch) | |
tree | 7601f1baa7ee7e82c24ee631fcb3c4f86d3df617 /source/fitz | |
parent | 4d6d027dc9b72e945e4c8bb8c650e8110d2cf9a0 (diff) | |
download | mupdf-cf371385d50ea718e8af8bb18f2fce28690a46c4.tar.xz |
Fix Memento crash
When reallocing set the rawsize before attempting to write
the post guard block.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/memento.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/fitz/memento.c b/source/fitz/memento.c index 58f7285c..35e4001c 100644 --- a/source/fitz/memento.c +++ b/source/fitz/memento.c @@ -2080,6 +2080,9 @@ static void *do_realloc(void *blk, size_t newsize, int type) memset(newbytes, MEMENTO_ALLOCFILL, newsize - newmemblk->rawsize); VALGRIND_MAKE_MEM_UNDEFINED(newbytes, newsize - newmemblk->rawsize); } +#endif + newmemblk->rawsize = newsize; +#ifndef MEMENTO_LEAKONLY VALGRIND_MAKE_MEM_DEFINED(newmemblk->preblk, Memento_PreSize); memset(newmemblk->preblk, MEMENTO_PREFILL, Memento_PreSize); VALGRIND_MAKE_MEM_UNDEFINED(newmemblk->preblk, Memento_PreSize); @@ -2087,7 +2090,6 @@ static void *do_realloc(void *blk, size_t newsize, int type) memset(MEMBLK_POSTPTR(newmemblk), MEMENTO_POSTFILL, Memento_PostSize); VALGRIND_MAKE_MEM_UNDEFINED(MEMBLK_POSTPTR(newmemblk), Memento_PostSize); #endif - newmemblk->rawsize = newsize; Memento_addBlockHead(&memento.used, newmemblk, 2); return MEMBLK_TOBLK(newmemblk); } |