mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
gst/realmedia/rmdemux.c: Use alignment-safe macros here too (subbuffers ...); guard against hypothetical memory acces...
Original commit message from CVS: * gst/realmedia/rmdemux.c: (gst_rmdemux_descramble_dnet_audio): Use alignment-safe macros here too (subbuffers ...); guard against hypothetical memory access beyond our given buffer in the case where the buffer size is not a multiple of 2.
This commit is contained in:
parent
7e1371c41e
commit
334fdce1d0
2 changed files with 14 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
2006-12-15 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/realmedia/rmdemux.c: (gst_rmdemux_descramble_dnet_audio):
|
||||
Use alignment-safe macros here too (subbuffers ...); guard against
|
||||
hypothetical memory access beyond our given buffer in the case
|
||||
where the buffer size is not a multiple of 2.
|
||||
|
||||
2006-12-15 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_handle_seek_event),
|
||||
|
|
|
@ -1869,18 +1869,19 @@ gst_rmdemux_descramble_dnet_audio (GstRMDemux * rmdemux,
|
|||
GstRMDemuxStream * stream)
|
||||
{
|
||||
GstBuffer *buf;
|
||||
guint16 *data, *end;
|
||||
guint8 *data, *end;
|
||||
|
||||
buf = g_ptr_array_index (stream->subpackets, 0);
|
||||
g_ptr_array_index (stream->subpackets, 0) = NULL;
|
||||
g_ptr_array_set_size (stream->subpackets, 0);
|
||||
|
||||
/* descramble is a bit of a misnomer, it's just byte-order swapped AC3 .. */
|
||||
data = (guint16 *) GST_BUFFER_DATA (buf);
|
||||
end = (guint16 *) (GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf));
|
||||
while (data < end) {
|
||||
*data = GUINT16_SWAP_LE_BE (*data);
|
||||
++data;
|
||||
data = GST_BUFFER_DATA (buf);
|
||||
end = GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf);
|
||||
while ((data + 1) < end) {
|
||||
/* byte-swap in an alignment-safe way */
|
||||
GST_WRITE_UINT16_BE (data, GST_READ_UINT16_LE (data));
|
||||
data += sizeof (guint16);
|
||||
}
|
||||
|
||||
return gst_pad_push (stream->pad, buf);
|
||||
|
|
Loading…
Reference in a new issue