Skip to content

gvariant: Realign data on construction if it’s not properly aligned

Philip Withnall requested to merge pwithnall/glib:1342-gvariant-alignment into master

Otherwise the GVariant would later fail internal alignment checks, aborting the program.

If unaligned data is provided to (for example) g_variant_new_from_data(), it will copy the data into a new aligned allocation. This is slow, but better than crashing. If callers want better performance, they should provide aligned data in their call, and it will not be copied or reallocated.

Includes a unit test.

Signed-off-by: Philip Withnall

#1342 (closed)

Closes #1342 (closed)

Merge request reports