summaryrefslogtreecommitdiffstats
path: root/gst/matroska/ebml-read.c
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-04-10 16:09:03 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-04-10 16:09:03 +0000
commitf0b8ef9f38367fb7d011195c0ec79f9cd18b5131 (patch)
treefb1d85b7519cf09ef0bb38aae5596c2c592c3a89 /gst/matroska/ebml-read.c
parent683ed4dc0ca84428abd3c71687e8bdc11e27dce4 (diff)
gst/matroska/ebml-read.c: Don't try to modify read-only data.
Original commit message from CVS: * gst/matroska/ebml-read.c: (gst_ebml_read_sint): Don't try to modify read-only data. * gst/matroska/matroska-demux.c: (gst_matroska_demux_parse_blockgroup_or_simpleblock): Fix comment (won't crash any longer now).
Diffstat (limited to 'gst/matroska/ebml-read.c')
-rw-r--r--gst/matroska/ebml-read.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gst/matroska/ebml-read.c b/gst/matroska/ebml-read.c
index fd4a4899..e9dbe504 100644
--- a/gst/matroska/ebml-read.c
+++ b/gst/matroska/ebml-read.c
@@ -487,7 +487,6 @@ gst_ebml_read_sint (GstEbmlRead * ebml, guint32 * id, gint64 * num)
if (!gst_ebml_read_buffer (ebml, id, &buf))
return FALSE;
- data = GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf);
if (size < 1 || size > 8) {
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
@@ -496,10 +495,16 @@ gst_ebml_read_sint (GstEbmlRead * ebml, guint32 * id, gint64 * num)
gst_buffer_unref (buf);
return FALSE;
}
+
+ buf = gst_buffer_make_writable (buf);
+
+ data = GST_BUFFER_DATA (buf);
+
if (data[0] & 0x80) {
negative = 1;
data[0] &= ~0x80;
}
+
*num = 0;
while (n < size) {
*num = (*num << 8) | data[n++];