summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-06-11 22:25:31 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-06-11 22:25:31 +0000
commitb2a11b3a6cd1b3d603571ac6db8dfd5ffbada50a (patch)
tree330602c62544ba2a780117efe94fed0f92960407
parentbd639dc3e4a5cea0ae27bb61725241273c79a478 (diff)
parent16dbc71b65e637b35699b9e6bbabe989d4bad0b3 (diff)
downloadsonivox-oreo-m2-s5-release.tar.gz
Merge cherrypicks of [4314166, 4314167, 4314168, 4314169, 4314462, 4314463, 4314464, 4314465, 4314466, 4314643, 4314644, 4314185, 4314467, 4314468, 4315341, 4315342, 4315343, 4315344, 4315345, 4314469, 4314283, 4314186, 4314187, 4314188, 4314189, 4314190, 4314191, 4314192, 4315082, 4315083, 4315084, 4315085, 4315086, 4315087, 4315088, 4315089, 4315090, 4315091, 4315092, 4314170, 4314284, 4314285, 4314286, 4314287, 4314171, 4314172, 4315346, 4314288, 4315381, 4315401, 4315402, 4314289, 4314290, 4314291, 4314292, 4314293, 4314294, 4314295, 4314296, 4314297, 4314298, 4314299, 4314300, 4315421, 4315422, 4314034, 4314229, 4315347, 4315423, 4315424, 4315314, 4315348, 4315349, 4314470, 4315425, 4315426, 4315427, 4315428, 4315429] into sparse-4732990-L02900000181396755android-8.1.0_r36oreo-m2-s5-release
Change-Id: I1fc754978059b7ffb938aea4173120f84728f437
-rw-r--r--arm-wt-22k/lib_src/eas_smf.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/arm-wt-22k/lib_src/eas_smf.c b/arm-wt-22k/lib_src/eas_smf.c
index 8b54b8e..3c284eb 100644
--- a/arm-wt-22k/lib_src/eas_smf.c
+++ b/arm-wt-22k/lib_src/eas_smf.c
@@ -29,6 +29,8 @@
*----------------------------------------------------------------------------
*/
+#include "log/log.h"
+
#include "eas_data.h"
#include "eas_miditypes.h"
#include "eas_parser.h"
@@ -833,6 +835,20 @@ static EAS_RESULT SMF_ParseMetaEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData
/* get the current file position so we can skip the event */
if ((result = EAS_HWFilePos(pEASData->hwInstData, pSMFStream->fileHandle, &pos)) != EAS_SUCCESS)
return result;
+
+ /* prevent a large unsigned length from being treated as a negative length */
+ if ((EAS_I32) len < 0) {
+ /* note that EAS_I32 is a long, which can be 64-bits on some computers */
+ ALOGE("b/68953854 SMF_ParseMetaEvent, negative len = %ld\n", (EAS_I32) len);
+ return EAS_ERROR_FILE_FORMAT;
+ }
+ /* prevent numeric overflow caused by a very large len, assume pos > 0 */
+ const EAS_I32 EAS_I32_MAX = 0x7FFFFFFF;
+ if ((EAS_I32) len > (EAS_I32_MAX - pos)) {
+ ALOGE("b/68953854 SMF_ParseMetaEvent, too large len = %ld\n", (EAS_I32) len);
+ return EAS_ERROR_FILE_FORMAT;
+ }
+
pos += (EAS_I32) len;
/* end of track? */