diff options
author | Eric Laurent <elaurent@google.com> | 2014-10-31 00:26:23 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-31 00:26:23 +0000 |
commit | ca83dd27f6c662bcbb0cea204c4df7ca77a479fd (patch) | |
tree | 95f757e844428af69933cbbe7c745f497784af5b | |
parent | b6dcdbf436ffacb52a41ac8ef9b07f99fd64779f (diff) | |
parent | 42f785c5d5ae596d781171327c98c541f0517feb (diff) | |
download | frameworks_av-ca83dd27f6c662bcbb0cea204c4df7ca77a479fd.zip frameworks_av-ca83dd27f6c662bcbb0cea204c4df7ca77a479fd.tar.gz frameworks_av-ca83dd27f6c662bcbb0cea204c4df7ca77a479fd.tar.bz2 |
am 42f785c5: am 4fbe49a8: am 96016c2d: am 9944ff09: am 70c3507d: am 450b10c9: am d0f9dc71: am e0a65f30: am f5af3a72: am 6d80b687: audio policy: validate stream type received from binder calls.
* commit '42f785c5d5ae596d781171327c98c541f0517feb':
audio policy: validate stream type received from binder calls.
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index 646a317..21452c8 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -228,6 +228,9 @@ audio_io_handle_t AudioPolicyService::getOutput(audio_stream_type_t stream, audio_output_flags_t flags, const audio_offload_info_t *offloadInfo) { + if (uint32_t(stream) >= AUDIO_STREAM_CNT) { + return 0; + } if (mpAudioPolicy == NULL) { return 0; } @@ -241,6 +244,9 @@ status_t AudioPolicyService::startOutput(audio_io_handle_t output, audio_stream_type_t stream, int session) { + if (uint32_t(stream) >= AUDIO_STREAM_CNT) { + return BAD_VALUE; + } if (mpAudioPolicy == NULL) { return NO_INIT; } @@ -253,6 +259,9 @@ status_t AudioPolicyService::stopOutput(audio_io_handle_t output, audio_stream_type_t stream, int session) { + if (uint32_t(stream) >= AUDIO_STREAM_CNT) { + return BAD_VALUE; + } if (mpAudioPolicy == NULL) { return NO_INIT; } @@ -451,6 +460,9 @@ status_t AudioPolicyService::getStreamVolumeIndex(audio_stream_type_t stream, uint32_t AudioPolicyService::getStrategyForStream(audio_stream_type_t stream) { + if (uint32_t(stream) >= AUDIO_STREAM_CNT) { + return 0; + } if (mpAudioPolicy == NULL) { return 0; } @@ -461,6 +473,9 @@ uint32_t AudioPolicyService::getStrategyForStream(audio_stream_type_t stream) audio_devices_t AudioPolicyService::getDevicesForStream(audio_stream_type_t stream) { + if (uint32_t(stream) >= AUDIO_STREAM_CNT) { + return (audio_devices_t)0; + } if (mpAudioPolicy == NULL) { return (audio_devices_t)0; } @@ -506,8 +521,11 @@ status_t AudioPolicyService::setEffectEnabled(int id, bool enabled) bool AudioPolicyService::isStreamActive(audio_stream_type_t stream, uint32_t inPastMs) const { + if (uint32_t(stream) >= AUDIO_STREAM_CNT) { + return false; + } if (mpAudioPolicy == NULL) { - return 0; + return false; } Mutex::Autolock _l(mLock); return mpAudioPolicy->is_stream_active(mpAudioPolicy, stream, inPastMs); |