Add bounds check for dls samples
Bug: 151096540
Test: manual
Change-Id: Ia40bc8dfba512451438322bb720035973138bd7d
(cherry picked from commit b67202e2673ce68051635a3d91217364a4841a1d)
diff --git a/arm-wt-22k/lib_src/eas_mdls.c b/arm-wt-22k/lib_src/eas_mdls.c
index 876ce9b..fac6987 100644
--- a/arm-wt-22k/lib_src/eas_mdls.c
+++ b/arm-wt-22k/lib_src/eas_mdls.c
@@ -1372,6 +1372,10 @@
{
return EAS_SUCCESS;
}
+ if (sampleLen < sizeof(EAS_SAMPLE)
+ || (pWsmp->loopStart + pWsmp->loopLength) * sizeof(EAS_SAMPLE) > sampleLen - sizeof(EAS_SAMPLE)) {
+ return EAS_FAILURE;
+ }
pSample[(pWsmp->loopStart + pWsmp->loopLength)>>1] = pSample[(pWsmp->loopStart)>>1];
}