aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/audionode.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2018-09-03 20:30:06 +0530
committerManish Goregaokar <manishsmail@gmail.com>2018-09-03 20:31:52 +0530
commit28c21421ca2cbf32e5f92cb6756e400bc639c036 (patch)
tree2dd87c93280bb4711dc15b4eddad1f2b5ca05724 /components/script/dom/audionode.rs
parent0ac861ca94970070dfa74120ef4f4286001f2523 (diff)
downloadservo-28c21421ca2cbf32e5f92cb6756e400bc639c036.tar.gz
servo-28c21421ca2cbf32e5f92cb6756e400bc639c036.zip
Throw on out-of-bounds channelCount in AudioNodes
Diffstat (limited to 'components/script/dom/audionode.rs')
-rw-r--r--components/script/dom/audionode.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs
index b48a902a8b4..5a149dd814f 100644
--- a/components/script/dom/audionode.rs
+++ b/components/script/dom/audionode.rs
@@ -44,9 +44,14 @@ impl AudioNode {
options: &AudioNodeOptions,
number_of_inputs: u32,
number_of_outputs: u32,
- ) -> AudioNode {
+ ) -> Fallible<AudioNode> {
+ if let Some(c) = options.channelCount {
+ if c == 0 || c > MAX_CHANNEL_COUNT {
+ return Err(Error::NotSupported);
+ }
+ }
let node_id = context.audio_context_impl().create_node(node_type);
- AudioNode::new_inherited_for_id(node_id, context, options, number_of_inputs, number_of_outputs)
+ Ok(AudioNode::new_inherited_for_id(node_id, context, options, number_of_inputs, number_of_outputs))
}
pub fn new_inherited_for_id(