summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2016-01-06 21:34:36 (GMT)
committerandroid-build-merger <android-build-merger@google.com>2016-01-06 21:34:36 (GMT)
commit68ea08e38ae022a548cde64b6c71a8cb608c799f (patch)
tree22d17d59559f2d9740a707a08ac28ff83e06759f
parent23eb37d08f13fe570632bd26b4f2a830f16c1983 (diff)
parent7ddf08ce3b31d4eff8a05c5001c9af084baad533 (diff)
downloadandroid_external_sonivox-68ea08e38ae022a548cde64b6c71a8cb608c799f.zip
android_external_sonivox-68ea08e38ae022a548cde64b6c71a8cb608c799f.tar.gz
android_external_sonivox-68ea08e38ae022a548cde64b6c71a8cb608c799f.tar.bz2
Sonivox: sanity check numSamples. am: 3ac044334c
am: 7ddf08ce3b * commit '7ddf08ce3b31d4eff8a05c5001c9af084baad533': Sonivox: sanity check numSamples.
-rw-r--r--arm-wt-22k/lib_src/eas_wtengine.c26
-rw-r--r--arm-wt-22k/lib_src/eas_wtsynth.c6
2 files changed, 32 insertions, 0 deletions
diff --git a/arm-wt-22k/lib_src/eas_wtengine.c b/arm-wt-22k/lib_src/eas_wtengine.c
index 224f60d..e7263fd 100644
--- a/arm-wt-22k/lib_src/eas_wtengine.c
+++ b/arm-wt-22k/lib_src/eas_wtengine.c
@@ -32,6 +32,8 @@
* includes
*------------------------------------
*/
+#include "log/log.h"
+
#include "eas_types.h"
#include "eas_math.h"
#include "eas_audioconst.h"
@@ -88,6 +90,10 @@ void WT_VoiceGain (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)
/* initialize some local variables */
numSamples = pWTIntFrame->numSamples;
+ if (numSamples <= 0) {
+ ALOGE("b/26366256");
+ return;
+ }
pMixBuffer = pWTIntFrame->pMixBuffer;
pInputBuffer = pWTIntFrame->pAudioBuffer;
@@ -182,6 +188,10 @@ void WT_Interpolate (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)
/* initialize some local variables */
numSamples = pWTIntFrame->numSamples;
+ if (numSamples <= 0) {
+ ALOGE("b/26366256");
+ return;
+ }
pOutputBuffer = pWTIntFrame->pAudioBuffer;
loopEnd = (const EAS_SAMPLE*) pWTVoice->loopEnd + 1;
@@ -275,6 +285,10 @@ void WT_InterpolateNoLoop (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)
/* initialize some local variables */
numSamples = pWTIntFrame->numSamples;
+ if (numSamples <= 0) {
+ ALOGE("b/26366256");
+ return;
+ }
pOutputBuffer = pWTIntFrame->pAudioBuffer;
phaseInc = pWTIntFrame->frame.phaseIncrement;
@@ -363,6 +377,10 @@ void WT_VoiceFilter (S_FILTER_CONTROL *pFilter, S_WT_INT_FRAME *pWTIntFrame)
/* initialize some local variables */
numSamples = pWTIntFrame->numSamples;
+ if (numSamples <= 0) {
+ ALOGE("b/26366256");
+ return;
+ }
pAudioBuffer = pWTIntFrame->pAudioBuffer;
z1 = pFilter->z1;
@@ -426,6 +444,10 @@ void WT_VoiceFilter (S_FILTER_CONTROL *pFilter, S_WT_INT_FRAME *pWTIntFrame)
/* initialize some local variables */
numSamples = pWTIntFrame->numSamples;
+ if (numSamples <= 0) {
+ ALOGE("b/26366256");
+ return;
+ }
pOutputBuffer = pWTIntFrame->pAudioBuffer;
phaseInc = pWTIntFrame->frame.phaseIncrement;
@@ -569,6 +591,10 @@ void WT_InterpolateMono (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)
EAS_I8 *pLoopStart;
numSamples = pWTIntFrame->numSamples;
+ if (numSamples <= 0) {
+ ALOGE("b/26366256");
+ return;
+ }
pMixBuffer = pWTIntFrame->pMixBuffer;
/* calculate gain increment */
diff --git a/arm-wt-22k/lib_src/eas_wtsynth.c b/arm-wt-22k/lib_src/eas_wtsynth.c
index 45cf4b1..25a70db 100644
--- a/arm-wt-22k/lib_src/eas_wtsynth.c
+++ b/arm-wt-22k/lib_src/eas_wtsynth.c
@@ -28,6 +28,8 @@
*/
// includes
+#include "log/log.h"
+
#include "eas_data.h"
#include "eas_report.h"
#include "eas_host.h"
@@ -467,6 +469,10 @@ EAS_BOOL WT_CheckSampleEnd (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame, E
} else {
pWTIntFrame->numSamples = numSamples;
}
+ if (pWTIntFrame->numSamples < 0) {
+ ALOGE("b/26366256");
+ pWTIntFrame->numSamples = 0;
+ }
/* sound will be done this frame */
done = EAS_TRUE;