summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-10-30 23:55:43 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-30 23:55:43 +0000
commit96016c2d583ccca9fffd6974cb9473f7effd6cf5 (patch)
tree1e08676a39464d8bd88c910bb3a11585dd3229f8 /services
parent0d83cf22991c48f4bb5f2afe3d16ae076861f394 (diff)
parent9944ff09ac4eb076cab994ef245b0103f60836ba (diff)
downloadframeworks_av-96016c2d583ccca9fffd6974cb9473f7effd6cf5.zip
frameworks_av-96016c2d583ccca9fffd6974cb9473f7effd6cf5.tar.gz
frameworks_av-96016c2d583ccca9fffd6974cb9473f7effd6cf5.tar.bz2
am 9944ff09: am 70c3507d: am 450b10c9: am d0f9dc71: am e0a65f30: am f5af3a72: am 6d80b687: audio policy: validate stream type received from binder calls.
* commit '9944ff09ac4eb076cab994ef245b0103f60836ba': 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 4256fc4..2ff0cc4 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;
}
@@ -235,6 +238,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;
}
@@ -247,6 +253,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;
}
@@ -422,6 +431,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;
}
@@ -432,6 +444,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;
}
@@ -477,8 +492,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);