File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -796,6 +796,10 @@ void* Parcel::writeInplace(size_t len)
796796 // printf("Writing %ld bytes, padded to %ld\n", len, padded);
797797 uint8_t * const data = mData +mDataPos ;
798798
799+ if (status_t status = validateReadData (mDataPos + padded); status != OK) {
800+ return nullptr ; // drops status
801+ }
802+
799803 // Need to pad at end?
800804 if (padded != len) {
801805#if BYTE_ORDER == BIG_ENDIAN
@@ -1313,6 +1317,10 @@ status_t Parcel::writeObject(const flat_binder_object& val, bool nullMetaData)
13131317 const bool enoughObjects = mObjectsSize < mObjectsCapacity ;
13141318 if (enoughData && enoughObjects) {
13151319restart_write:
1320+ if (status_t status = validateReadData (mDataPos + sizeof (val)); status != OK) {
1321+ return status;
1322+ }
1323+
13161324 *reinterpret_cast <flat_binder_object*>(mData +mDataPos ) = val;
13171325
13181326 // remember if it's a file descriptor
@@ -1505,6 +1513,10 @@ status_t Parcel::writeAligned(T val) {
15051513
15061514 if ((mDataPos +sizeof (val)) <= mDataCapacity ) {
15071515restart_write:
1516+ if (status_t status = validateReadData (mDataPos + sizeof (val)); status != OK) {
1517+ return status;
1518+ }
1519+
15081520 *reinterpret_cast <T*>(mData +mDataPos ) = val;
15091521 return finishWrite (sizeof (val));
15101522 }
You can’t perform that action at this time.
0 commit comments