diff --git a/ChangeLog b/ChangeLog index b525a5b2c2..78d55f2d84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-01-16 Tim-Philipp Müller + + * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps): + * gst-libs/gst/tag/gstvorbistag.c: + (gst_tag_list_to_vorbiscomment_buffer): + * gst/typefind/gsttypefindfunctions.c: (vorbis_type_find): + Fix potentially unaligned access (#397207). + 2007-01-16 Stefan Kost * tests/examples/seek/seek.c: (set_scale), (update_scale), diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c index 1da0f775ec..d786223704 100644 --- a/gst-libs/gst/riff/riff-media.c +++ b/gst-libs/gst/riff/riff-media.c @@ -631,12 +631,16 @@ gst_riff_create_video_caps (guint32 codec_fcc, GST_BUFFER_SIZE (palette)); #if (G_BYTE_ORDER == G_BIG_ENDIAN) - gint n; - guint32 *data = (guint32 *) GST_BUFFER_DATA (copy); + { + guint8 *data = GST_BUFFER_DATA (copy); + gint n; - /* own endianness */ - for (n = 0; n < num_colors; n++) - data[n] = GUINT32_FROM_LE (data[n]); + /* own endianness */ + for (n = 0; n < num_colors; n++) { + GST_WRITE_UINT32_BE (data, GST_READ_UINT32_LE (data)); + data += sizeof (guint32); + } + } #endif gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, copy, NULL); gst_buffer_unref (copy); diff --git a/gst-libs/gst/tag/gstvorbistag.c b/gst-libs/gst/tag/gstvorbistag.c index 2e58174a78..42d949d58a 100644 --- a/gst-libs/gst/tag/gstvorbistag.c +++ b/gst-libs/gst/tag/gstvorbistag.c @@ -516,12 +516,12 @@ gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list, memcpy (data, id_data, id_data_length); data += id_data_length; } - *((guint32 *) data) = GUINT32_TO_LE (vendor_len); + GST_WRITE_UINT32_LE (data, vendor_len); data += 4; memcpy (data, vendor_string, vendor_len); data += vendor_len; l = my_data.entries = g_list_reverse (my_data.entries); - *((guint32 *) data) = GUINT32_TO_LE (my_data.count); + GST_WRITE_UINT32_LE (data, my_data.count); data += 4; for (i = 0; i < my_data.count; i++) { guint size; @@ -531,7 +531,7 @@ gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list, cur = l->data; l = g_list_next (l); size = strlen (cur); - *((guint32 *) data) = GUINT32_TO_LE (size); + GST_WRITE_UINT32_LE (data, size); data += 4; memcpy (data, cur, size); data += size; diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index b90447e939..92b69b8ada 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -2104,7 +2104,7 @@ vorbis_type_find (GstTypeFind * tf, gpointer private) return; data++; /* 4 byte samplerate must be != 0 */ - if (*((guint32 *) data) == 0) + if (GST_READ_UINT32_LE (data) == 0) return; data += 16; /* blocksize checks */