summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2014-02-19 22:06:09 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-02-19 22:06:09 +0000
commit79aa621330e1fefcfc7ccf7c14ef51a8d0ea8c9c (patch)
treea3f18f8300c3ceaa1eb4a2b5f0fefc9ccfef2751 /libs
parent382f1cc1f19e0d1a8019a57a84d4a4dd201b5f8c (diff)
parent7cc5b8800c22790b0db9ea0af62fcad2cc998303 (diff)
downloadframeworks_native-79aa621330e1fefcfc7ccf7c14ef51a8d0ea8c9c.zip
frameworks_native-79aa621330e1fefcfc7ccf7c14ef51a8d0ea8c9c.tar.gz
frameworks_native-79aa621330e1fefcfc7ccf7c14ef51a8d0ea8c9c.tar.bz2
am 7cc5b880: am e45636a8: am d437364e: am f50b9eaa: Binder: Make sure binder objects do not overlap
* commit '7cc5b8800c22790b0db9ea0af62fcad2cc998303': Binder: Make sure binder objects do not overlap
Diffstat (limited to 'libs')
-rw-r--r--libs/binder/Parcel.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 3791ad5..870071d 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -35,6 +35,7 @@
#include <private/binder/binder_module.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@@ -1382,6 +1383,7 @@ size_t Parcel::ipcObjectsCount() const
void Parcel::ipcSetDataReference(const uint8_t* data, size_t dataSize,
const binder_size_t* objects, size_t objectsCount, release_func relFunc, void* relCookie)
{
+ binder_size_t minOffset = 0;
freeDataNoInit();
mError = NO_ERROR;
mData = const_cast<uint8_t*>(data);
@@ -1394,6 +1396,16 @@ void Parcel::ipcSetDataReference(const uint8_t* data, size_t dataSize,
mNextObjectHint = 0;
mOwner = relFunc;
mOwnerCookie = relCookie;
+ for (size_t i = 0; i < mObjectsSize; i++) {
+ binder_size_t offset = mObjects[i];
+ if (offset < minOffset) {
+ ALOGE("%s: bad object offset %"PRIu64" < %"PRIu64"\n",
+ __func__, (uint64_t)offset, (uint64_t)minOffset);
+ mObjectsSize = 0;
+ break;
+ }
+ minOffset = offset + sizeof(flat_binder_object);
+ }
scanForFds();
}