From e619a697ededd37b3645c3970a4f71af7d663524 Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Tue, 25 Jan 2011 09:26:11 -0800 Subject: [PATCH] Bug 3388299 Fix stack buffer overrun Change-Id: I715affa4f6599afabc0bc9b56981edce2edcc95b --- wilhelm/src/android/android_Effect.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wilhelm/src/android/android_Effect.cpp b/wilhelm/src/android/android_Effect.cpp index 5cab91e6..38ec90ed 100644 --- a/wilhelm/src/android/android_Effect.cpp +++ b/wilhelm/src/android/android_Effect.cpp @@ -32,6 +32,8 @@ static const int ENVREVERB_PARAM_SIZE_MAX_SINGLE = sizeof(effect_param_t) + 2 * static const int ENVREVERB_PARAM_SIZE_MAX_ALL = sizeof(effect_param_t) + sizeof(int32_t) + sizeof(s_reverb_settings); +static const int PRESETREVERB_PARAM_SIZE_MAX = sizeof(effect_param_t) + 2 * sizeof(int32_t); + static inline SLuint32 KEY_FROM_GUID(SLInterfaceID pUuid) { return pUuid->time_low; } @@ -366,8 +368,8 @@ void android_prev_init(IPresetReverb* ipr) { //----------------------------------------------------------------------------- android::status_t android_prev_setPreset(android::sp pFx, uint16_t preset) { - android::status_t status = android_fx_setParam(pFx, REVERB_PARAM_PRESET, sizeof(uint16_t), - &preset, sizeof(uint16_t)); + android::status_t status = android_fx_setParam(pFx, REVERB_PARAM_PRESET, + PRESETREVERB_PARAM_SIZE_MAX, &preset, sizeof(uint16_t)); // enable the effect if the preset is different from SL_REVERBPRESET_NONE pFx->setEnabled(SL_REVERBPRESET_NONE != preset); return status; @@ -375,7 +377,7 @@ android::status_t android_prev_setPreset(android::sp pFx, //----------------------------------------------------------------------------- android::status_t android_prev_getPreset(android::sp pFx, uint16_t* preset) { - return android_fx_getParam(pFx, REVERB_PARAM_PRESET, sizeof(uint16_t), preset, + return android_fx_getParam(pFx, REVERB_PARAM_PRESET, PRESETREVERB_PARAM_SIZE_MAX, preset, sizeof(uint16_t)); } -- 2.11.0