Skip to content

Commit a95f8ed

Browse files
jduckandi34
authored andcommitted
Fix integer underflow in covr MPEG4 processing
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
1 parent 00b3442 commit a95f8ed

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

media/libstagefright/MPEG4Extractor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,10 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
17621762
return ERROR_IO;
17631763
}
17641764
const int kSkipBytesOfDataBox = 16;
1765+
if (chunk_data_size <= kSkipBytesOfDataBox) {
1766+
return ERROR_MALFORMED;
1767+
}
1768+
17651769
mFileMetaData->setData(
17661770
kKeyAlbumArt, MetaData::TYPE_NONE,
17671771
buffer->data() + kSkipBytesOfDataBox, chunk_data_size - kSkipBytesOfDataBox);

0 commit comments

Comments
 (0)