mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-25 15:36:42 +00:00
gst/: Fix potentially unaligned access (#397207).
Original commit message from CVS: * 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).
This commit is contained in:
parent
268dcb0ab1
commit
0eac623115
4 changed files with 21 additions and 9 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2007-01-16 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* 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 <ensonic@users.sf.net>
|
2007-01-16 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* tests/examples/seek/seek.c: (set_scale), (update_scale),
|
* tests/examples/seek/seek.c: (set_scale), (update_scale),
|
||||||
|
|
|
@ -631,12 +631,16 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
||||||
GST_BUFFER_SIZE (palette));
|
GST_BUFFER_SIZE (palette));
|
||||||
|
|
||||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||||
|
{
|
||||||
|
guint8 *data = GST_BUFFER_DATA (copy);
|
||||||
gint n;
|
gint n;
|
||||||
guint32 *data = (guint32 *) GST_BUFFER_DATA (copy);
|
|
||||||
|
|
||||||
/* own endianness */
|
/* own endianness */
|
||||||
for (n = 0; n < num_colors; n++)
|
for (n = 0; n < num_colors; n++) {
|
||||||
data[n] = GUINT32_FROM_LE (data[n]);
|
GST_WRITE_UINT32_BE (data, GST_READ_UINT32_LE (data));
|
||||||
|
data += sizeof (guint32);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, copy, NULL);
|
gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, copy, NULL);
|
||||||
gst_buffer_unref (copy);
|
gst_buffer_unref (copy);
|
||||||
|
|
|
@ -516,12 +516,12 @@ gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
|
||||||
memcpy (data, id_data, id_data_length);
|
memcpy (data, id_data, id_data_length);
|
||||||
data += id_data_length;
|
data += id_data_length;
|
||||||
}
|
}
|
||||||
*((guint32 *) data) = GUINT32_TO_LE (vendor_len);
|
GST_WRITE_UINT32_LE (data, vendor_len);
|
||||||
data += 4;
|
data += 4;
|
||||||
memcpy (data, vendor_string, vendor_len);
|
memcpy (data, vendor_string, vendor_len);
|
||||||
data += vendor_len;
|
data += vendor_len;
|
||||||
l = my_data.entries = g_list_reverse (my_data.entries);
|
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;
|
data += 4;
|
||||||
for (i = 0; i < my_data.count; i++) {
|
for (i = 0; i < my_data.count; i++) {
|
||||||
guint size;
|
guint size;
|
||||||
|
@ -531,7 +531,7 @@ gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
|
||||||
cur = l->data;
|
cur = l->data;
|
||||||
l = g_list_next (l);
|
l = g_list_next (l);
|
||||||
size = strlen (cur);
|
size = strlen (cur);
|
||||||
*((guint32 *) data) = GUINT32_TO_LE (size);
|
GST_WRITE_UINT32_LE (data, size);
|
||||||
data += 4;
|
data += 4;
|
||||||
memcpy (data, cur, size);
|
memcpy (data, cur, size);
|
||||||
data += size;
|
data += size;
|
||||||
|
|
|
@ -2104,7 +2104,7 @@ vorbis_type_find (GstTypeFind * tf, gpointer private)
|
||||||
return;
|
return;
|
||||||
data++;
|
data++;
|
||||||
/* 4 byte samplerate must be != 0 */
|
/* 4 byte samplerate must be != 0 */
|
||||||
if (*((guint32 *) data) == 0)
|
if (GST_READ_UINT32_LE (data) == 0)
|
||||||
return;
|
return;
|
||||||
data += 16;
|
data += 16;
|
||||||
/* blocksize checks */
|
/* blocksize checks */
|
||||||
|
|
Loading…
Reference in a new issue