summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-10-30 23:01:01 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-30 23:01:01 +0000
commitd0f9dc7156e531d5cd0615f6e682d2449e08e9a7 (patch)
treeb586fddb4c97ee094a3a3b266f1833f115aa2b89 /services
parentcb5dc219b78e6eeacb7ee2f5c93e6763db677122 (diff)
parente0a65f3008ac5874106b21d03e19296c8015da41 (diff)
downloadframeworks_av-d0f9dc7156e531d5cd0615f6e682d2449e08e9a7.zip
frameworks_av-d0f9dc7156e531d5cd0615f6e682d2449e08e9a7.tar.gz
frameworks_av-d0f9dc7156e531d5cd0615f6e682d2449e08e9a7.tar.bz2
am e0a65f30: am f5af3a72: am 6d80b687: audio policy: validate stream type received from binder calls.
* commit 'e0a65f3008ac5874106b21d03e19296c8015da41': audio policy: validate stream type received from binder calls.
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioPolicyService.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index 8b99bd2..63f9bcb 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -222,6 +222,9 @@ audio_io_handle_t AudioPolicyService::getOutput(audio_stream_type_t stream,
audio_channel_mask_t channelMask,
audio_output_flags_t flags)
{
+ if (uint32_t(stream) >= AUDIO_STREAM_CNT) {
+ return 0;
+ }
if (mpAudioPolicy == NULL) {
return 0;
}
@@ -234,6 +237,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;
}
@@ -246,6 +252,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;
}
@@ -421,6 +430,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;
}
@@ -431,6 +443,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;
}
@@ -476,8 +491,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);