diff options
author | Wei Jia <wjia@google.com> | 2015-08-13 16:42:54 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-13 16:42:54 +0000 |
commit | 3bb658acd971414b15b0957e131294db33f7b75b (patch) | |
tree | 4089efba56d8cf5d2c86de02f1097743e6168fc3 /media/libstagefright/id3/ID3.cpp | |
parent | b6131acd69ea32df926125d94c16174bc0ce1d4a (diff) | |
parent | 4e86a483a12b0139a8babf4754e5de340eaccd40 (diff) | |
download | frameworks_av-3bb658acd971414b15b0957e131294db33f7b75b.zip frameworks_av-3bb658acd971414b15b0957e131294db33f7b75b.tar.gz frameworks_av-3bb658acd971414b15b0957e131294db33f7b75b.tar.bz2 |
am 4e86a483: am f51115bd: libstagefright: fix possible overflow in ID3.
* commit '4e86a483a12b0139a8babf4754e5de340eaccd40':
libstagefright: fix possible overflow in ID3.
Diffstat (limited to 'media/libstagefright/id3/ID3.cpp')
-rw-r--r-- | media/libstagefright/id3/ID3.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp index 3ef175b..894a9c9 100644 --- a/media/libstagefright/id3/ID3.cpp +++ b/media/libstagefright/id3/ID3.cpp @@ -327,7 +327,7 @@ bool ID3::removeUnsynchronizationV2_4(bool iTunesHack) { size_t oldSize = mSize; size_t offset = 0; - while (offset + 10 <= mSize) { + while (mSize >= 10 && offset <= mSize - 10) { if (!memcmp(&mData[offset], "\0\0\0\0", 4)) { break; } @@ -339,7 +339,7 @@ bool ID3::removeUnsynchronizationV2_4(bool iTunesHack) { return false; } - if (offset + dataSize + 10 > mSize) { + if (dataSize > mSize - 10 - offset) { return false; } @@ -349,6 +349,9 @@ bool ID3::removeUnsynchronizationV2_4(bool iTunesHack) { if (flags & 1) { // Strip data length indicator + if (mSize < 14 || mSize - 14 < offset) { + return false; + } memmove(&mData[offset + 10], &mData[offset + 14], mSize - offset - 14); mSize -= 4; dataSize -= 4; |