Skip to content
  • Allison Karlitskaya's avatar
    GVariant: One more FreeBSD fix · e7927faf
    Allison Karlitskaya authored
    FreeBSD's malloc() sometimes returns unaligned memory if you are
    requesting small sizes.  This can get GVariant into trouble.  For
    example, consider the type "mmi" containing the value "just nothing".
    According to the type signature, the memory containing this should be
    aligned to a boundary of 4 since it might contain an int.  The
    serialised size of this value is 1 byte, however, and when you ask
    FreeBSD to allocate memory of that size, it knows you can't put an int
    into it so it doesn't bother aligning it.
    
    This patch modifies the GVariant serialiser to not assert the alignment
    constraint in the case that the size of the serialised data is smaller
    than its own alignment requirement.
    e7927faf