[automerger] Increment when attempting to read protected Parcel Data am: 6a825e8ad1 am: 7ae915f9bd am: 21c05cbf8f
Change-Id: I41fe9b982b47c06069c801571ee80f6ed8efbb38
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index ef72b3e..a4b89a9 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1159,7 +1159,12 @@
&& len <= pad_size(len)) {
if (mObjectsSize > 0) {
status_t err = validateReadData(mDataPos + pad_size(len));
- if(err != NO_ERROR) return err;
+ if(err != NO_ERROR) {
+ // Still increment the data position by the expected length
+ mDataPos += pad_size(len);
+ ALOGV("read Setting data pos of %p to %zu", this, mDataPos);
+ return err;
+ }
}
memcpy(outData, mData+mDataPos, len);
mDataPos += pad_size(len);
@@ -1181,7 +1186,12 @@
&& len <= pad_size(len)) {
if (mObjectsSize > 0) {
status_t err = validateReadData(mDataPos + pad_size(len));
- if(err != NO_ERROR) return NULL;
+ if(err != NO_ERROR) {
+ // Still increment the data position by the expected length
+ mDataPos += pad_size(len);
+ ALOGV("readInplace Setting data pos of %p to %zu", this, mDataPos);
+ return NULL;
+ }
}
const void* data = mData+mDataPos;
@@ -1199,7 +1209,11 @@
if ((mDataPos+sizeof(T)) <= mDataSize) {
if (mObjectsSize > 0) {
status_t err = validateReadData(mDataPos + sizeof(T));
- if(err != NO_ERROR) return err;
+ if(err != NO_ERROR) {
+ // Still increment the data position by the expected length
+ mDataPos += sizeof(T);
+ return err;
+ }
}
const void* data = mData+mDataPos;