summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-01-07 18:10:49 +0200
committerTim-Philipp Müller <tim@centricular.com>2016-01-11 23:18:01 +0000
commit7f00b64e77b08d288479b8b479c386f50307495c (patch)
treef66165a2d7ab1a349ce18d5b959eee23c0a5f086
parent0e2316849800f0640aed318e2b31a5ff55617b0d (diff)
downloadgstreamer-plugins-bad-7f00b64e77b08d288479b8b479c386f50307495c.tar.gz
mxftypes: Don't store pointers in stack allocated guints
This works usually in this place, unless the compiler optimizes things in interesting ways in which case it causes stack corruption and crashes later. The compiler in question here is clang with -O1, which seems to pack the stack a bit more and causes writing to the guint as pointer to overwrite map.memory, which then later crashes during unmapping of the memory.
-rw-r--r--gst/mxf/mxftypes.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gst/mxf/mxftypes.c b/gst/mxf/mxftypes.c
index 55ac8be0b..d857efe88 100644
--- a/gst/mxf/mxftypes.c
+++ b/gst/mxf/mxftypes.c
@@ -1474,15 +1474,14 @@ mxf_primer_pack_to_buffer (const MXFPrimerPack * pack)
data += 8;
if (pack->mappings) {
- guint local_tag;
+ gpointer local_tag;
MXFUL *ul;
GHashTableIter iter;
g_hash_table_iter_init (&iter, pack->mappings);
- while (g_hash_table_iter_next (&iter, (gpointer) & local_tag,
- (gpointer) & ul)) {
- GST_WRITE_UINT16_BE (data, local_tag);
+ while (g_hash_table_iter_next (&iter, &local_tag, (gpointer) & ul)) {
+ GST_WRITE_UINT16_BE (data, GPOINTER_TO_UINT (local_tag));
memcpy (data + 2, ul, 16);
data += 18;
}