From: Nick Mathewson Date: Thu, 7 Apr 2016 15:10:14 +0000 (-0400) Subject: memarea: Don't assume that sizeof(ulong) >= sizeof(void*). X-Git-Tag: tor-0.2.8.3-alpha~60^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39c057d45a67f9aa80bc05df85ec8deafdb6f46a;p=thirdparty%2Ftor.git memarea: Don't assume that sizeof(ulong) >= sizeof(void*). Fixes bug 18716; bugfix on 0.2.1.1-alpha where memarea.c was introduced. Found by wbenny. --- diff --git a/changes/bug18716 b/changes/bug18716 new file mode 100644 index 0000000000..b15a343f4c --- /dev/null +++ b/changes/bug18716 @@ -0,0 +1,4 @@ + o Minor bugfixes (assert, portability): + - Fix an assertion failure in memarea.c on systems where "long" is + shorter than the size of a pointer. + Fixes bug 18716; bugfix on 0.2.1.1-alpha diff --git a/src/common/memarea.c b/src/common/memarea.c index 6841ba54e7..6c7e4c7d64 100644 --- a/src/common/memarea.c +++ b/src/common/memarea.c @@ -22,9 +22,9 @@ #define MEMAREA_ALIGN SIZEOF_VOID_P #if MEMAREA_ALIGN == 4 -#define MEMAREA_ALIGN_MASK 3lu +#define MEMAREA_ALIGN_MASK ((uintptr_t)3) #elif MEMAREA_ALIGN == 8 -#define MEMAREA_ALIGN_MASK 7lu +#define MEMAREA_ALIGN_MASK ((uintptr_t)7) #else #error "void* is neither 4 nor 8 bytes long. I don't know how to align stuff." #endif