Merge "Remove possible div by zero in WavExtractor" am: acd2186aa2 am: b8e13b1b1a
am: ce92aba3ab
* commit 'ce92aba3ab05f7d653908acc7e9be73128dd5ccd':
Remove possible div by zero in WavExtractor
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index b30376d..51d639d 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -194,7 +194,9 @@
mNumChannels = U16_LE_AT(&formatSpec[2]);
if (mWaveFormat != WAVE_FORMAT_EXTENSIBLE) {
- if (mNumChannels != 1 && mNumChannels != 2) {
+ if (mNumChannels == 0) {
+ return ERROR_UNSUPPORTED;
+ } else if (mNumChannels != 1 && mNumChannels != 2) {
ALOGW("More than 2 channels (%d) in non-WAVE_EXT, unknown channel mask",
mNumChannels);
}