diff options
author | Andy Hung <hunga@google.com> | 2016-04-28 13:43:44 -0700 |
---|---|---|
committer | The Android Automerger <android-build@google.com> | 2016-05-27 11:31:30 -0700 |
commit | 073a80800f341325932c66818ce4302b312909a4 (patch) | |
tree | d016e6ae68111687fbcb1555db11360e51cda955 | |
parent | a18111d2db2a5e43a5ba318073986c12f9c86720 (diff) | |
download | hardware_qcom_audio-073a80800f341325932c66818ce4302b312909a4.tar.gz hardware_qcom_audio-073a80800f341325932c66818ce4302b312909a4.tar.bz2 hardware_qcom_audio-073a80800f341325932c66818ce4302b312909a4.zip |
DO NOT MERGE Fix AudioEffect reply overflow
Bug: 28173666
Change-Id: I055af37a721b20c5da0f1ec4b02f630dcd5aee02
-rw-r--r-- | post_proc/bundle.c | 5 | ||||
-rw-r--r-- | voice_processing/voice_processing.c | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/post_proc/bundle.c b/post_proc/bundle.c index a6b07278..df327ab7 100644 --- a/post_proc/bundle.c +++ b/post_proc/bundle.c @@ -621,8 +621,9 @@ int effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(uint32_t)) || pReplyData == NULL || - *replySize < (int)(sizeof(effect_param_t) + sizeof(uint32_t) + - sizeof(uint16_t))) { + *replySize < (int)(sizeof(effect_param_t) + sizeof(uint32_t) + sizeof(uint16_t)) || + // constrain memcpy below + ((effect_param_t *)pCmdData)->psize > *replySize - sizeof(effect_param_t)) { status = -EINVAL; ALOGV("EFFECT_CMD_GET_PARAM invalid command cmdSize %d *replySize %d", cmdSize, *replySize); diff --git a/voice_processing/voice_processing.c b/voice_processing/voice_processing.c index b3f97c6a..7d2b5929 100644 --- a/voice_processing/voice_processing.c +++ b/voice_processing/voice_processing.c @@ -560,7 +560,9 @@ static int fx_command(effect_handle_t self, if (pCmdData == NULL || cmdSize < (int)sizeof(effect_param_t) || pReplyData == NULL || - *replySize < (int)sizeof(effect_param_t)) { + *replySize < (int)sizeof(effect_param_t) || + // constrain memcpy below + ((effect_param_t *)pCmdData)->psize > *replySize - sizeof(effect_param_t)) { ALOGV("fx_command() EFFECT_CMD_GET_PARAM invalid args"); return -EINVAL; } |