amrnb: Restart the p_xn pointer when retraversing the array on overflow
This is a safeguard to avoid issues in a rare codepath.
This was committed on the master branch of the opencore
repository in commit f532d145194e474cb30d8644b8eee83873ad24cc,
based on AOSP contribution 10905.
Change-Id: I9688b009bcbe63d88ee5040e883a021aefa30664
diff --git a/media/libstagefright/codecs/amrnb/enc/src/g_pitch.cpp b/media/libstagefright/codecs/amrnb/enc/src/g_pitch.cpp
index f6235ad..5b80e2a 100644
--- a/media/libstagefright/codecs/amrnb/enc/src/g_pitch.cpp
+++ b/media/libstagefright/codecs/amrnb/enc/src/g_pitch.cpp
@@ -400,8 +400,9 @@
}
else
{
- s = 0; /* Avoid case of all zeros */
+ s = 0; /* re-initialize calculations */
p_y1 = &y1[0];
+ p_xn = &xn[0];
for (i = (L_subfr >> 2); i != 0; i--)
{
L_temp = (Word32)(*(p_y1++) >> 2);