summaryrefslogtreecommitdiffstats
path: root/libs/utils
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-05-22 13:20:23 -0700
committerDianne Hackborn <hackbod@google.com>2009-05-22 13:51:47 -0700
commit6aff905048ba3b03724f17e2aba9089872e14cd2 (patch)
tree2e9887f1d73e0783595ea629dd606737171b2387 /libs/utils
parent9681a5e06badbd817342e8f6be4ffbe9102c1e98 (diff)
downloadframeworks_base-6aff905048ba3b03724f17e2aba9089872e14cd2.zip
frameworks_base-6aff905048ba3b03724f17e2aba9089872e14cd2.tar.gz
frameworks_base-6aff905048ba3b03724f17e2aba9089872e14cd2.tar.bz2
Fix a major bug in Bundle when unparcelling from AIDL.
There was a serious problem in the Bundle(Parcel) and readFromParcel() methods, where it wasn't doing the copying of the Parcel that Parcel.readBundle() does and is a basic requirement for it to work correctly. This re-arranges the code to make all of these functions (hopefully) correct. Also fix a problem in Parcel where we were not duping fds when copying data from one Parcel to another.
Diffstat (limited to 'libs/utils')
-rw-r--r--libs/utils/Parcel.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/utils/Parcel.cpp b/libs/utils/Parcel.cpp
index e74ad4a..b0e3750 100644
--- a/libs/utils/Parcel.cpp
+++ b/libs/utils/Parcel.cpp
@@ -409,12 +409,16 @@ status_t Parcel::appendFrom(Parcel *parcel, size_t offset, size_t len)
mObjects[idx++] = off;
mObjectsSize++;
- const flat_binder_object* flat
+ flat_binder_object* flat
= reinterpret_cast<flat_binder_object*>(mData + off);
acquire_object(proc, *flat, this);
- // take note if the object is a file descriptor
if (flat->type == BINDER_TYPE_FD) {
+ // If this is a file descriptor, we need to dup it so the
+ // new Parcel now owns its own fd, and can declare that we
+ // officially know we have fds.
+ flat->handle = dup(flat->handle);
+ flat->cookie = (void*)1;
mHasFds = mFdsKnown = true;
}
}