File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -888,6 +888,10 @@ void* Parcel::writeInplace(size_t len)
888888 // printf("Writing %ld bytes, padded to %ld\n", len, padded);
889889 uint8_t * const data = mData +mDataPos ;
890890
891+ if (status_t status = validateReadData (mDataPos + padded); status != OK) {
892+ return nullptr ; // drops status
893+ }
894+
891895 // Need to pad at end?
892896 if (padded != len) {
893897#if BYTE_ORDER == BIG_ENDIAN
@@ -1405,6 +1409,10 @@ status_t Parcel::writeObject(const flat_binder_object& val, bool nullMetaData)
14051409 const bool enoughObjects = mObjectsSize < mObjectsCapacity ;
14061410 if (enoughData && enoughObjects) {
14071411restart_write:
1412+ if (status_t status = validateReadData (mDataPos + sizeof (val)); status != OK) {
1413+ return status;
1414+ }
1415+
14081416 *reinterpret_cast <flat_binder_object*>(mData +mDataPos ) = val;
14091417
14101418 // remember if it's a file descriptor
@@ -1621,6 +1629,10 @@ status_t Parcel::writeAligned(T val) {
16211629
16221630 if ((mDataPos +sizeof (val)) <= mDataCapacity ) {
16231631restart_write:
1632+ if (status_t status = validateReadData (mDataPos + sizeof (val)); status != OK) {
1633+ return status;
1634+ }
1635+
16241636 memcpy (mData + mDataPos , &val, sizeof (val));
16251637 return finishWrite (sizeof (val));
16261638 }
You can’t perform that action at this time.
0 commit comments