summaryrefslogtreecommitdiff
path: root/gst/aiff
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2014-06-12 10:00:55 +0100
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2014-06-12 10:00:55 +0100
commit174fc1015e49a61c86cf2067596440d2c9cf332c (patch)
treefe978894dee16240f2cc30bf768691dd29722740 /gst/aiff
parentdb887f05cafdae8588150daeaa71bf99cfa3c6a2 (diff)
downloadgstreamer-plugins-bad-174fc1015e49a61c86cf2067596440d2c9cf332c.tar.gz
aiffparse: bail out early when bytes per sample is not set
This should always be set for valid files when we get there, and checking this avoids having ad hoc checks further down in several places. Coverity 1139698
Diffstat (limited to 'gst/aiff')
-rw-r--r--gst/aiff/aiffparse.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gst/aiff/aiffparse.c b/gst/aiff/aiffparse.c
index 1ba9e79e0..14a499311 100644
--- a/gst/aiff/aiffparse.c
+++ b/gst/aiff/aiffparse.c
@@ -1247,6 +1247,12 @@ gst_aiff_parse_stream_data (GstAiffParse * aiff)
GstClockTime timestamp, next_timestamp, duration;
guint64 pos, nextpos;
+ if (aiff->bytes_per_sample <= 0) {
+ GST_ELEMENT_ERROR (aiff, STREAM, WRONG_TYPE, (NULL),
+ ("File is not a valid AIFF file (invalid bytes per sample)"));
+ return GST_FLOW_ERROR;
+ }
+
iterate_adapter:
GST_LOG_OBJECT (aiff,
"offset: %" G_GINT64_FORMAT " , end: %" G_GINT64_FORMAT " , dataleft: %"
@@ -1262,7 +1268,7 @@ iterate_adapter:
MIN (gst_guint64_to_gdouble (aiff->dataleft),
aiff->max_buf_size * ABS (aiff->segment.rate));
- if (desired >= aiff->bytes_per_sample && aiff->bytes_per_sample > 0)
+ if (desired >= aiff->bytes_per_sample)
desired -= (desired % aiff->bytes_per_sample);
GST_LOG_OBJECT (aiff, "Fetching %" G_GINT64_FORMAT " bytes of data "