From 2177f21c1ae5bf5cb8c1113a1adbe1fd7db34206 Mon Sep 17 00:00:00 2001 From: Wei Jia Date: Wed, 3 Jun 2015 16:47:19 -0700 Subject: MPEG4Writer: add check to ensure no integer overflow on allocation. Bug: 20674584 Change-Id: I77ef1891abf0a20994840a87fa99e55a62f40a70 --- media/libstagefright/MPEG4Writer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'media/libstagefright/MPEG4Writer.cpp') diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp index 95f361e..99dc543 100644 --- a/media/libstagefright/MPEG4Writer.cpp +++ b/media/libstagefright/MPEG4Writer.cpp @@ -113,6 +113,8 @@ private: mCurrTableEntriesElement(NULL) { CHECK_GT(mElementCapacity, 0); CHECK_GT(mEntryCapacity, 0); + // Ensure no integer overflow on allocation in add(). + CHECK_LT(mEntryCapacity, UINT32_MAX / mElementCapacity); } // Free the allocated memory. -- cgit v1.1