diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2012-05-04 01:33:58 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2012-05-04 01:33:58 +0000 |
commit | 652349d0a5b9b9504fc2e9d145c3f2c83776d7df (patch) | |
tree | 44c4ef6742ebf21d21e57b98ef25bceb2353ce89 /epan/emem.c | |
parent | a151b7c3e33b1b43eb1ae8ddaef477f936e70f16 (diff) |
Partial fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7221
(emem alignment problems on SPARC) :
Add the room for the pointer to the next (from r31577) *before* calculating
the canary+pad: that way the complete allocation
(allocation+canary_ptr+canary+pad) will end on an 8-byte boundary (as was the
case before r31577).
This only solves the alignment problem when using canaries (i.e., not, by
default, se_ allocations).
(And, yes, this is ignoring the 16-byte alignment requirements of long
doubles.)
svn path=/trunk/; revision=42407
Diffstat (limited to 'epan/emem.c')
-rw-r--r-- | epan/emem.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/epan/emem.c b/epan/emem.c index 0e5478efcc..2e9503accc 100644 --- a/epan/emem.c +++ b/epan/emem.c @@ -753,11 +753,12 @@ emem_alloc_chunk(size_t size, emem_header_t *mem) /* Allocate room for at least 8 bytes of canary plus some padding * so the canary ends on an 8-byte boundary. - * Then add the room needed for the pointer to the next canary. + * But first add the room needed for the pointer to the next canary + * (so the entire allocation will end on an 8-byte boundary). */ if (use_canary) { - pad = emem_canary_pad(asize); asize += sizeof(void *); + pad = emem_canary_pad(asize); } else pad = (G_MEM_ALIGN - (asize & (G_MEM_ALIGN-1))) & (G_MEM_ALIGN-1); |