]> granicus.if.org Git - postgis/commitdiff
32bit allocations are 4-byte aligned, not 8-byte aligned.
authorDarafei Praliaskouski <me@komzpa.net>
Sat, 21 Jul 2018 14:20:52 +0000 (14:20 +0000)
committerDarafei Praliaskouski <me@komzpa.net>
Sat, 21 Jul 2018 14:20:52 +0000 (14:20 +0000)
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

raster/rt_core/rt_serialize.c

index 9d17aa0288b563b5fa7e5fd681247c01fb341e4c..eb5a87715dd9f9ae2ea0589e05863d8df361e4f4 100644 (file)
@@ -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) */