|
Message-Id: <20170627175847.13827-1-amonakov@ispras.ru> Date: Tue, 27 Jun 2017 20:58:47 +0300 From: Alexander Monakov <amonakov@...ras.ru> To: musl@...ts.openwall.com Subject: [PATCH] fix undefined behavior in free --- src/malloc/malloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/malloc/malloc.c b/src/malloc/malloc.c index 720fa696..ef4c7368 100644 --- a/src/malloc/malloc.c +++ b/src/malloc/malloc.c @@ -463,14 +463,15 @@ copy_realloc: void free(void *p) { - struct chunk *self = MEM_TO_CHUNK(p); - struct chunk *next; + struct chunk *self, *next; size_t final_size, new_size, size; int reclaim=0; int i; if (!p) return; + self = MEM_TO_CHUNK(p); + if (IS_MMAPPED(self)) { size_t extra = self->psize; char *base = (char *)self - extra; -- 2.11.0
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.