After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 661839 - Invalid alignment assumptions
Invalid alignment assumptions
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other All
: Normal major
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-10-15 11:57 UTC by Thorsten Glaser
Modified: 2015-02-07 16:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to fix this issue (builds successfully on m68k now) (1.17 KB, patch)
2011-10-15 13:54 UTC, Thorsten Glaser
none Details | Review
patch to fix the problem, updated 1 time (1.28 KB, patch)
2011-11-20 15:38 UTC, Thorsten Glaser
none Details | Review

Description Thorsten Glaser 2011-10-15 11:57:01 UTC
The current source has invalid assumptions about structure alignment that break on m68k because 32-bit quantities require only 16-bit alignment there. A fix for this by introducing explicit structure padding to make the binary representation generated by the compiler match the text of the specification exactly will be attached. (The fix was written by Andreas Schwab, thanks!)
Comment 1 Thorsten Glaser 2011-10-15 13:54:51 UTC
Created attachment 199063 [details] [review]
patch to fix this issue (builds successfully on m68k now)
Comment 2 Thorsten Glaser 2011-10-15 14:02:03 UTC
Actually, all parts of “the stack” should be checked for such assumptions; basically, everywhere a “smaller” value (here: gint8, guint16) is followed by a “bigger” value (here: SimpleTypeBlob and guint32, respectively) or a type smaller than 4 octets is used at the end of a structure (Header). Otherwise you _will_ get binary incompatibilities which are… not nice. (Isn’t there a -Wpadding option to GCC?)
Comment 3 Thorsten Glaser 2011-11-20 15:38:13 UTC
Created attachment 201741 [details] [review]
patch to fix the problem, updated 1 time
Comment 4 Thorsten Glaser 2011-11-20 15:40:17 UTC
I can confirm that “gobject-introspection (1.31.0-2) unstable” (including its
upstream portion) still exhibits the problem.

Please apply the patch I supplied. I’ve rebased it against 1.31.0 now and am
currently building it and talking to the Debian maintainer about inclusion,
too.
Comment 5 Martin Pitt 2012-02-08 06:16:59 UTC
OK to push this now?
Comment 6 Colin Walters 2012-02-08 13:41:20 UTC
Initially I was a little worried that this will change the typelib binary format on some platforms, but upon inspection it looks safe.
Comment 7 Colin Walters 2012-02-08 14:08:43 UTC
commit 9e56835f5ebb601aa0cb22130555a8a4ef15b11b
Author: Thorsten Glaser <tg@debian.org>
Date:   Wed Feb 8 09:02:37 2012 -0500

    typelib: Fix invalid alignment assumptions
    
    The current source has invalid assumptions about structure alignment
    that break on platforms like m68k where 32-bit integers are aligned to
    16-bit only. Fix this by introducing explicit structure padding for
    32-bit quantities following odd numbers of 16-bit quantities and
    structure trail padding, to make the binary representation generated
    by the compiler match the text of the specification exactly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=661839
Comment 8 Thorsten Glaser 2012-02-08 16:52:30 UTC
(In reply to comment #6)
> Initially I was a little worried that this will change the typelib binary
> format on some platforms

Well yes, it changed it on m68k to match that of all other platforms ;-)

In fact, the changes take the previously implicit padding and make it explicit
and any platform that would be affected by it would not previously have worked
at all.

Thanks!
Comment 9 André Klapper 2015-02-07 16:53:50 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]