summaryrefslogtreecommitdiff
path: root/girepository/girmodule.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2013-12-28 19:37:18 -0500
committerRyan Lortie <desrt@desrt.ca>2013-12-30 22:31:53 -0500
commitfe7fd5dc0e61b9b546a65a0d14f498f6514b072f (patch)
tree25a8570fdb59c10f9617f8e48918dc0eb0784c82 /girepository/girmodule.c
parentf27aff293b8f811dbea6311d06be42eec2d980d8 (diff)
downloadgobject-introspection-fe7fd5dc0e61b9b546a65a0d14f498f6514b072f.tar.gz
typelib compiler: properly initialise memory
The typelib compiler was writing uninitialised memory to the output file. There were two sources of this uninitialised memory: the hash writer included some uninitialised memory in its output, and the bytes added after the hash output for padding were also not being initialised. Fix this by passing the padded size to the hash code writer function and having that function initialise the entire memory region to zero before writing. https://bugzilla.gnome.org/show_bug.cgi?id=721177
Diffstat (limited to 'girepository/girmodule.c')
-rw-r--r--girepository/girmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/girepository/girmodule.c b/girepository/girmodule.c
index 05c8987f..e3897c34 100644
--- a/girepository/girmodule.c
+++ b/girepository/girmodule.c
@@ -279,8 +279,9 @@ add_directory_index_section (guint8 *data, GIrModule *module, guint32 *offset2)
alloc_section (data, GI_SECTION_DIRECTORY_INDEX, *offset2);
required_size = _gi_typelib_hash_builder_get_buffer_size (dirindex_builder);
+ required_size = ALIGN_VALUE (required_size, 4);
- new_offset = *offset2 + ALIGN_VALUE (required_size, 4);
+ new_offset = *offset2 + required_size;
data = g_realloc (data, new_offset);