Skip to content

Commit 02efc70

Browse files
Treehugger RobotAndroid (Google) Code Review
authored andcommitted
Merge "Parcel: Avoid realloc on owned Parcels." into main
2 parents 5236eed + 575fdb3 commit 02efc70

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

libs/binder/Parcel.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,15 @@ status_t Parcel::writeObject(const flat_binder_object& val, bool nullMetaData)
18041804
return finishWrite(sizeof(flat_binder_object));
18051805
}
18061806

1807+
if (mOwner) {
1808+
// continueWrite does have the logic to convert this from an
1809+
// owned to an unowned Parcel. However, this is pretty inefficient,
1810+
// and it's really strange to need to do so, so prefer to avoid
1811+
// these paths than try to support them.
1812+
ALOGE("writing objects not supported on owned Parcels");
1813+
return PERMISSION_DENIED;
1814+
}
1815+
18071816
if (!enoughData) {
18081817
const status_t err = growData(sizeof(val));
18091818
if (err != NO_ERROR) return err;

0 commit comments

Comments
 (0)