Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: Source/modules/webaudio/OfflineAudioContext.cpp

Issue 27039002: Fix crash when the OfflineAudioContext constructor is given 0 as numberOfFrames (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 30 matching lines...) Expand all
41 // FIXME: add support for workers. 41 // FIXME: add support for workers.
42 if (!context || !context->isDocument()) { 42 if (!context || !context->isDocument()) {
43 es.throwDOMException( 43 es.throwDOMException(
44 NotSupportedError, 44 NotSupportedError,
45 ExceptionMessages::failedToConstruct("OfflineAudioContext")); 45 ExceptionMessages::failedToConstruct("OfflineAudioContext"));
46 return 0; 46 return 0;
47 } 47 }
48 48
49 Document* document = toDocument(context); 49 Document* document = toDocument(context);
50 50
51 if (!numberOfFrames) {
52 es.throwDOMException(
53 SyntaxError,
54 ExceptionMessages::failedToConstruct(
55 "OfflineAudioContext",
56 "number of frames cannot be zero."));
57 return 0;
58 }
59
51 if (numberOfChannels > 10) { 60 if (numberOfChannels > 10) {
52 es.throwDOMException( 61 es.throwDOMException(
53 SyntaxError, 62 SyntaxError,
54 ExceptionMessages::failedToConstruct( 63 ExceptionMessages::failedToConstruct(
55 "OfflineAudioContext", 64 "OfflineAudioContext",
56 "number of channels (" + String::number(numberOfChannels) + ") e xceeds maximum (10).")); 65 "number of channels (" + String::number(numberOfChannels) + ") e xceeds maximum (10)."));
57 return 0; 66 return 0;
58 } 67 }
59 68
60 if (!isSampleRateRangeGood(sampleRate)) { 69 if (!isSampleRateRangeGood(sampleRate)) {
(...skipping 16 matching lines...) Expand all
77 ScriptWrappable::init(this); 86 ScriptWrappable::init(this);
78 } 87 }
79 88
80 OfflineAudioContext::~OfflineAudioContext() 89 OfflineAudioContext::~OfflineAudioContext()
81 { 90 {
82 } 91 }
83 92
84 } // namespace WebCore 93 } // namespace WebCore
85 94
86 #endif // ENABLE(WEB_AUDIO) 95 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« Source/modules/webaudio/AudioContext.cpp ('K') | « Source/modules/webaudio/AudioContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698