summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-09-11 23:09:05 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-09-11 23:09:05 +0000
commit9e6ee5969c0dfaa2b35ccd7ce5958bf9ffc7eeca (patch)
treeee48f4439cd4fd6a83adb8585c29d33ec3d0cfdc
parentc4b4c545341a7cb6565a5661c59bd07c713283a3 (diff)
parent0fbe6200eabb68f31aea0377fa1ead8b496fffd6 (diff)
downloadsonivox-oreo-m8-release.tar.gz
Merge cherrypicks of [4995494, 4995495, 4995496, 4995497, 4997652, 4997881, 4997052, 4997883, 4995518, 4997653, 4997654] into oc-m8-releaseandroid-8.1.0_r67android-8.1.0_r65android-8.1.0_r64android-8.1.0_r63android-8.1.0_r62android-8.1.0_r61android-8.1.0_r60android-8.1.0_r53android-8.1.0_r51oreo-m8-release
Change-Id: I07fac7857786280ae052a33787c6ca32bc7edf7f
-rw-r--r--arm-wt-22k/lib_src/eas_public.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/arm-wt-22k/lib_src/eas_public.c b/arm-wt-22k/lib_src/eas_public.c
index eb41113..19481b5 100644
--- a/arm-wt-22k/lib_src/eas_public.c
+++ b/arm-wt-22k/lib_src/eas_public.c
@@ -1247,12 +1247,13 @@ static EAS_RESULT EAS_ParseEvents (S_EAS_DATA *pEASData, EAS_HANDLE pStream, EAS
EAS_BOOL done;
EAS_INT yieldCount = YIELD_EVENT_COUNT;
EAS_U32 time = 0;
+
// This constant is the maximum number of events that can be processed in a single time slice.
// A typical ringtone will contain a few events per time slice.
// Extremely dense ringtones might go up to 50 events.
// If we see this many events then the file is probably stuck in an infinite loop
- // and should be aborted. In our testing, it took less than 100 msec to hit this limit.
- static const EAS_INT MAX_EVENT_COUNT = 50000;
+ // and should be aborted.
+ static const EAS_INT MAX_EVENT_COUNT = 100000;
EAS_INT eventCount = 0;
/* does this parser have a time function? */
@@ -1308,10 +1309,14 @@ static EAS_RESULT EAS_ParseEvents (S_EAS_DATA *pEASData, EAS_HANDLE pStream, EAS
return result;
}
}
- // An infinite loop within a single frame of a ringtone file can cause this function
+
+ // An infinite loop within a ringtone file can cause this function
// to loop forever. Try to detect that and return an error.
- if (++eventCount >= MAX_EVENT_COUNT) {
- ALOGE("%s() aborting, %d events without advancing to next frame",
+ // Only check when playing. Otherwise a very large file could be rejected
+ // when scanning the entire file in a single call to this function.
+ // OTA files will only do infinite loops when in eParserModePlay.
+ if (++eventCount >= MAX_EVENT_COUNT && parseMode == eParserModePlay) {
+ ALOGE("%s() aborting, %d events. Infinite loop in song file?!",
__func__, eventCount);
android_errorWriteLog(0x534e4554, "68664359");
return EAS_ERROR_FILE_POS;