Skip to content

Commit 575fdb3

Browse files
author
Steven Moreland
committed
Parcel: Avoid realloc on owned Parcels.
Continuation of support to allow 'write' calls on Parcel objects in any state. That is, any call on any Parcel API in any state should be valid. Bug: 382799130 Test: with fuzzer Change-Id: Ib139ee941f070724fb61ecb3ada2fc689545b11b
1 parent 7051e5b commit 575fdb3

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)