OSDN Git Service

Fix integer underflow in covr MPEG4 processing
authorJoshua J. Drake <android-open-source@qoop.org>
Mon, 4 May 2015 22:14:11 +0000 (17:14 -0500)
committerLajos Molnar <lajos@google.com>
Wed, 3 Jun 2015 22:24:49 +0000 (15:24 -0700)
When the 'chunk_data_size' variable is less than 'kSkipBytesOfDataBox', an
integer underflow can occur. This causes an extraordinarily large value to
be passed to MetaData::setData, leading to a buffer overflow.

Bug: 20923261
Change-Id: Icd28f63594ad941eabb3a12c750a4a2d5d2bf94b

media/libstagefright/MPEG4Extractor.cpp

index d52b605..5640b50 100644 (file)
@@ -1758,6 +1758,10 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                     return ERROR_IO;
                 }
                 const int kSkipBytesOfDataBox = 16;
+                if (chunk_data_size <= kSkipBytesOfDataBox) {
+                    return ERROR_MALFORMED;
+                }
+
                 mFileMetaData->setData(
                     kKeyAlbumArt, MetaData::TYPE_NONE,
                     buffer->data() + kSkipBytesOfDataBox, chunk_data_size - kSkipBytesOfDataBox);