From b7a162348de2f1444377e2dca9f3cbf9d770b52d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20M=C3=BChlstrasser?= Date: Wed, 21 Oct 2015 09:01:31 +0200 Subject: [PATCH] Avoid pointer arithmetic with (void *) pointers. --- src/lib/openjp2/opj_malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/openjp2/opj_malloc.c b/src/lib/openjp2/opj_malloc.c index 04ef055c..a4aea30f 100644 --- a/src/lib/openjp2/opj_malloc.c +++ b/src/lib/openjp2/opj_malloc.c @@ -166,7 +166,7 @@ static INLINE void *opj_aligned_realloc_n(void *ptr, size_t alignment, size_t ne size_t new_offset; /* realloc created a new copy, realign the copied memory block */ - old_offset = (size_t)(ptr - oldmem); + old_offset = (size_t)((OPJ_UINT8*)ptr - (OPJ_UINT8*)oldmem); /* offset = ((alignment + 1U) - ((size_t)(mem + sizeof(void*)) & alignment)) & alignment; */ /* Use the fact that alignment + 1U is a power of 2 */