summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Tinker <jtinker@google.com>2015-08-11 15:52:26 -0700
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2015-10-19 02:38:37 +0200
commite33fadf02a9d08f71086bd4f1487c0571c828fa2 (patch)
tree6f6bfbcef858b28143cb8ac3d883e0db6d75ae15
parent028af4dfa4fc39522d14c4a97f2b9096f8de1379 (diff)
downloadframeworks_av-e33fadf02a9d08f71086bd4f1487c0571c828fa2.zip
frameworks_av-e33fadf02a9d08f71086bd4f1487c0571c828fa2.tar.gz
frameworks_av-e33fadf02a9d08f71086bd4f1487c0571c828fa2.tar.bz2
Check integer overflow to prevent memory corruption
bug: 23016072 Change-Id: If3c9a835408773847c0024a812bd8b4915ebd680 (cherry picked from commit fa8ebb45fd850f56ca1bf64fbed3ac11e10c7d3d) Tested-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
-rw-r--r--media/libstagefright/DRMExtractor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/media/libstagefright/DRMExtractor.cpp b/media/libstagefright/DRMExtractor.cpp
index 63cb430..9cb6e86 100644
--- a/media/libstagefright/DRMExtractor.cpp
+++ b/media/libstagefright/DRMExtractor.cpp
@@ -186,7 +186,8 @@ status_t DRMSource::read(MediaBuffer **buffer, const ReadOptions *options) {
srcOffset += mNALLengthSize;
- if (srcOffset + nalLength > len) {
+ size_t end = srcOffset + nalLength;
+ if (end > len || end < srcOffset) {
if (decryptedDrmBuffer.data) {
delete [] decryptedDrmBuffer.data;
decryptedDrmBuffer.data = NULL;