summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-12-16 23:57:26 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-12-16 23:57:26 +0000
commitb1fa159e5f442186f02b1428a77349623e9f2944 (patch)
tree364ee39f927166e5aeb3a1fb3989e41d67f54f1a
parenta8343f312c191f9e23469455f3eceff6bc989bbf (diff)
downloadgst-plugins-bad-b1fa159e5f442186f02b1428a77349623e9f2944.tar.gz
gst-plugins-bad-b1fa159e5f442186f02b1428a77349623e9f2944.tar.bz2
gst-plugins-bad-b1fa159e5f442186f02b1428a77349623e9f2944.zip
gst-libs/gst/riff/riff-read.c: Read extradata correctly (fixes #155879).
Original commit message from CVS: * gst-libs/gst/riff/riff-read.c: (gst_riff_read_strf_auds_with_data): Read extradata correctly (fixes #155879).
-rw-r--r--ChangeLog6
-rw-r--r--gst-libs/gst/riff/riff-read.c16
2 files changed, 15 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index dee092a8..d64511f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-12-17 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+
+ * gst-libs/gst/riff/riff-read.c:
+ (gst_riff_read_strf_auds_with_data):
+ Read extradata correctly (fixes #155879).
+
2004-12-16 David Schleef <ds@schleef.org>
* gst/audioscale/gstaudioscale.c: allow passthru of >2 channel
diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c
index d5394711..e77cb73e 100644
--- a/gst-libs/gst/riff/riff-read.c
+++ b/gst-libs/gst/riff/riff-read.c
@@ -664,16 +664,18 @@ gst_riff_read_strf_auds_with_data (GstRiffRead * riff,
/* size checking */
*extradata = NULL;
- if (strf->size > GST_BUFFER_SIZE (buf)) {
- g_warning ("strf_auds header gave %d bytes data, only %d available",
- strf->size, GST_BUFFER_SIZE (buf));
- strf->size = GST_BUFFER_SIZE (buf);
- } else if (strf->size < GST_BUFFER_SIZE (buf)) {
+ if (GST_BUFFER_SIZE (buf) > sizeof (gst_riff_strf_auds) + 2) {
gint len;
- len = GST_BUFFER_SIZE (buf) - strf->size - 2;
+ len = GST_READ_UINT16_LE (&GST_BUFFER_DATA (buf)[16]);
+ if (len + 2 + sizeof (gst_riff_strf_auds) > GST_BUFFER_SIZE (buf)) {
+ GST_WARNING ("Extradata indicated %d bytes, but only %d available",
+ len, GST_BUFFER_SIZE (buf) - 2 - sizeof (gst_riff_strf_auds));
+ len = GST_BUFFER_SIZE (buf) - 2 - sizeof (gst_riff_strf_auds);
+ }
if (len > 0) {
- *extradata = gst_buffer_create_sub (buf, strf->size + 2, len);
+ *extradata = gst_buffer_create_sub (buf,
+ sizeof (gst_riff_strf_auds) + 2, len);
}
}