File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1186,6 +1186,10 @@ void* Parcel::writeInplace(size_t len)
11861186 // printf("Writing %ld bytes, padded to %ld\n", len, padded);
11871187 uint8_t * const data = mData +mDataPos ;
11881188
1189+ if (status_t status = validateReadData (mDataPos + padded); status != OK) {
1190+ return nullptr ; // drops status
1191+ }
1192+
11891193 // Need to pad at end?
11901194 if (padded != len) {
11911195#if BYTE_ORDER == BIG_ENDIAN
@@ -1774,6 +1778,10 @@ status_t Parcel::writeObject(const flat_binder_object& val, bool nullMetaData)
17741778 const bool enoughObjects = kernelFields->mObjectsSize < kernelFields->mObjectsCapacity ;
17751779 if (enoughData && enoughObjects) {
17761780restart_write:
1781+ if (status_t status = validateReadData (mDataPos + sizeof (val)); status != OK) {
1782+ return status;
1783+ }
1784+
17771785 *reinterpret_cast <flat_binder_object*>(mData +mDataPos ) = val;
17781786
17791787 // remember if it's a file descriptor
@@ -2020,6 +2028,10 @@ status_t Parcel::writeAligned(T val) {
20202028
20212029 if ((mDataPos +sizeof (val)) <= mDataCapacity ) {
20222030restart_write:
2031+ if (status_t status = validateReadData (mDataPos + sizeof (val)); status != OK) {
2032+ return status;
2033+ }
2034+
20232035 memcpy (mData + mDataPos , &val, sizeof (val));
20242036 return finishWrite (sizeof (val));
20252037 }
You can’t perform that action at this time.
0 commit comments