[postgis-tickets] r16654 - 32bit allocations are 4-byte aligned, not 8-byte aligned.

Darafei komzpa at gmail.com
Sat Jul 21 07:20:52 PDT 2018


Author: komzpa
Date: 2018-07-21 07:20:52 -0700 (Sat, 21 Jul 2018)
New Revision: 16654

Modified:
   trunk/raster/rt_core/rt_serialize.c
Log:
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


Modified: trunk/raster/rt_core/rt_serialize.c
===================================================================
--- trunk/raster/rt_core/rt_serialize.c	2018-07-21 13:03:25 UTC (rev 16653)
+++ trunk/raster/rt_core/rt_serialize.c	2018-07-21 14:20:52 UTC (rev 16654)
@@ -688,11 +688,9 @@
 #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) */



More information about the postgis-tickets mailing list