summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorcevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 03:30:08 +0000
committercevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 03:30:08 +0000
commitd76d7c4b106b272e6c6cea47e5b91c9f8e83e31c (patch)
treeb9fdccef8ec7683952a81f835389286eac937f7b /webkit
parent2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589 (diff)
downloadchromium_src-d76d7c4b106b272e6c6cea47e5b91c9f8e83e31c.zip
chromium_src-d76d7c4b106b272e6c6cea47e5b91c9f8e83e31c.tar.gz
chromium_src-d76d7c4b106b272e6c6cea47e5b91c9f8e83e31c.tar.bz2
Apply limits consistent with offline audio contexts.
BUG=95004 Review URL: http://codereview.chromium.org/7822012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/media/audio_decoder.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/webkit/glue/media/audio_decoder.cc b/webkit/glue/media/audio_decoder.cc
index de3b078..56186fe 100644
--- a/webkit/glue/media/audio_decoder.cc
+++ b/webkit/glue/media/audio_decoder.cc
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/string_util.h"
#include "base/time.h"
+#include "media/base/limits.h"
#include "media/filters/audio_file_reader.h"
#include "media/filters/in_memory_url_protocol.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioBus.h"
@@ -40,6 +41,14 @@ bool DecodeAudioFileData(
double duration = reader.duration().InSecondsF();
size_t number_of_frames = static_cast<size_t>(reader.number_of_frames());
+ // Apply sanity checks to make sure crazy values aren't coming out of
+ // FFmpeg.
+ if (!number_of_channels ||
+ number_of_channels > static_cast<size_t>(media::Limits::kMaxChannels) ||
+ file_sample_rate < media::Limits::kMinSampleRate ||
+ file_sample_rate > media::Limits::kMaxSampleRate)
+ return false;
+
// TODO(crogers) : do sample-rate conversion with FFmpeg.
// For now, we're ignoring the requested 'sample_rate' and returning
// the WebAudioBus at the file's sample-rate.