From: Darafei Praliaskouski Date: Sat, 21 Jul 2018 14:20:52 +0000 (+0000) Subject: 32bit allocations are 4-byte aligned, not 8-byte aligned. X-Git-Tag: 2.5.0beta2~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1325a65ebf9fd3e8e3055259811ac44ec4227188;p=postgis 32bit allocations are 4-byte aligned, not 8-byte aligned. Fix 8-bit alignment assumption in padding to match assert. Passes tests on 32bit Ubuntu Artful. References #3994 git-svn-id: http://svn.osgeo.org/postgis/trunk@16654 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/rt_core/rt_serialize.c b/raster/rt_core/rt_serialize.c index 9d17aa028..eb5a87715 100644 --- a/raster/rt_core/rt_serialize.c +++ b/raster/rt_core/rt_serialize.c @@ -688,11 +688,9 @@ rt_raster_serialize(rt_raster raster) { #endif /* Pad up to 8-bytes boundary */ - while ((uintptr_t) ptr % 8) { + while ((ptr-ret) % 8) { *ptr = 0; ++ptr; - - RASTER_DEBUGF(3, "PAD at %d", (uintptr_t) ptr % 8); } /* Consistency checking (ptr is pixbytes-aligned) */