summaryrefslogtreecommitdiffstats
path: root/libs/binder
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2014-02-19 21:45:25 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-02-19 21:45:25 +0000
commitd437364ec156e07c5fbe3fa27a7cd55e5450e9f6 (patch)
treedda4b417f51429b7cb57f289657663adaf1d83a2 /libs/binder
parentf65ebc3be4d3a2e4c71c401d0e53f2ad5798be2a (diff)
parentf50b9eaaeeaeae16981f11b05d3f3a6fb0dea30d (diff)
downloadframeworks_native-d437364ec156e07c5fbe3fa27a7cd55e5450e9f6.zip
frameworks_native-d437364ec156e07c5fbe3fa27a7cd55e5450e9f6.tar.gz
frameworks_native-d437364ec156e07c5fbe3fa27a7cd55e5450e9f6.tar.bz2
am f50b9eaa: Binder: Make sure binder objects do not overlap
* commit 'f50b9eaaeeaeae16981f11b05d3f3a6fb0dea30d': Binder: Make sure binder objects do not overlap
Diffstat (limited to 'libs/binder')
-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 38e019c..882130f 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>
@@ -1317,6 +1318,7 @@ size_t Parcel::ipcObjectsCount() const
void Parcel::ipcSetDataReference(const uint8_t* data, size_t dataSize,
const 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);
@@ -1329,6 +1331,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();
}