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

Unified Diff: media/audio/audio_util.cc

Issue 6133001: Turn the volume range check into a bail out return to prevent browser crash.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_util.cc
===================================================================
--- media/audio/audio_util.cc (revision 70339)
+++ media/audio/audio_util.cc (working copy)
@@ -93,7 +93,8 @@
int bytes_per_sample,
float volume) {
DCHECK(buf);
- DCHECK(volume >= 0.0f && volume <= 1.0f);
+ if (volume < 0.0f || volume > 1.0f)
+ return false;
if (volume == 1.0f) {
return true;
} else if (volume == 0.0f) {
@@ -129,7 +130,8 @@
int bytes_per_sample,
float volume) {
DCHECK(buf);
- DCHECK(volume >= 0.0f && volume <= 1.0f);
+ if (volume < 0.0f || volume > 1.0f)
+ return false;
if (channels > 2 && channels <= 8 && bytes_per_sample > 0) {
int sample_count = buflen / (channels * bytes_per_sample);
if (bytes_per_sample == 1) {

Powered by Google App Engine
This is Rietveld 408576698