diff options
| author | 2021-10-13 11:24:35 -0700 | |
|---|---|---|
| committer | 2021-10-13 18:47:43 +0000 | |
| commit | 2034effbb3d79bc89e3dcde94fee92ece56c8206 (patch) | |
| tree | 4284dd07e0db4bf0061ff680dc72498601bb0e7a /libs/binder/Parcel.cpp | |
| parent | d8b3d5f05695af40955c2d3e1d40c51db437f977 (diff) | |
libbinder: Parcel::appendFrom better format check
(thanks jooyung@ for the catch here)
Even if we have two RPC parcels, they need to both be for the RPC
session. Otherwise, they might be at different versions (and we don't
really have a way to reconcile this).
Bug: 182939048
Test: binderRpcTest
Change-Id: I5180ebc681ccc79bf05a3fc0900a9b240e793a66
Diffstat (limited to 'libs/binder/Parcel.cpp')
| -rw-r--r-- | libs/binder/Parcel.cpp | 5 | 
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index dee5309602..805e5768bc 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -411,8 +411,9 @@ status_t Parcel::setData(const uint8_t* buffer, size_t len)  status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len)  { -    if (parcel->isForRpc() != isForRpc()) { -        ALOGE("Cannot append Parcel of one format to another."); +    if (mSession != parcel->mSession) { +        ALOGE("Cannot append Parcel from one context to another. They may be different formats, " +              "and objects are specific to a context.");          return BAD_TYPE;      }  |