Loading include/binder/Parcel.h +4 −1 Original line number Original line Diff line number Diff line Loading @@ -56,6 +56,8 @@ public: status_t appendFrom(const Parcel *parcel, status_t appendFrom(const Parcel *parcel, size_t start, size_t len); size_t start, size_t len); bool setAllowFds(bool allowFds); bool hasFileDescriptors() const; bool hasFileDescriptors() const; // Writes the RPC header. // Writes the RPC header. Loading Loading @@ -212,6 +214,7 @@ private: mutable bool mFdsKnown; mutable bool mFdsKnown; mutable bool mHasFds; mutable bool mHasFds; bool mAllowFds; release_func mOwner; release_func mOwner; void* mOwnerCookie; void* mOwnerCookie; Loading include/utils/Errors.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -72,6 +72,7 @@ enum { TIMED_OUT = 0x80000005, TIMED_OUT = 0x80000005, UNKNOWN_TRANSACTION = 0x80000006, UNKNOWN_TRANSACTION = 0x80000006, #endif #endif FDS_NOT_ALLOWED = 0x80000007, }; }; // Restore define; enumeration is in "android" namespace, so the value defined // Restore define; enumeration is in "android" namespace, so the value defined Loading libs/binder/Parcel.cpp +18 −1 Original line number Original line Diff line number Diff line Loading @@ -399,6 +399,8 @@ status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len) mDataPos += len; mDataPos += len; mDataSize += len; mDataSize += len; err = NO_ERROR; if (numObjects > 0) { if (numObjects > 0) { // grow objects // grow objects if (mObjectsCapacity < mObjectsSize + numObjects) { if (mObjectsCapacity < mObjectsSize + numObjects) { Loading Loading @@ -430,11 +432,21 @@ status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len) flat->handle = dup(flat->handle); flat->handle = dup(flat->handle); flat->cookie = (void*)1; flat->cookie = (void*)1; mHasFds = mFdsKnown = true; mHasFds = mFdsKnown = true; if (!mAllowFds) { err = FDS_NOT_ALLOWED; } } } } } } } return NO_ERROR; return err; } bool Parcel::setAllowFds(bool allowFds) { const bool origValue = mAllowFds; mAllowFds = allowFds; return origValue; } } bool Parcel::hasFileDescriptors() const bool Parcel::hasFileDescriptors() const Loading Loading @@ -759,6 +771,9 @@ restart_write: // remember if it's a file descriptor // remember if it's a file descriptor if (val.type == BINDER_TYPE_FD) { if (val.type == BINDER_TYPE_FD) { if (!mAllowFds) { return FDS_NOT_ALLOWED; } mHasFds = mFdsKnown = true; mHasFds = mFdsKnown = true; } } Loading Loading @@ -1283,6 +1298,7 @@ status_t Parcel::restartWrite(size_t desired) mNextObjectHint = 0; mNextObjectHint = 0; mHasFds = false; mHasFds = false; mFdsKnown = true; mFdsKnown = true; mAllowFds = true; return NO_ERROR; return NO_ERROR; } } Loading Loading @@ -1434,6 +1450,7 @@ void Parcel::initState() mNextObjectHint = 0; mNextObjectHint = 0; mHasFds = false; mHasFds = false; mFdsKnown = true; mFdsKnown = true; mAllowFds = true; mOwner = NULL; mOwner = NULL; } } Loading Loading
include/binder/Parcel.h +4 −1 Original line number Original line Diff line number Diff line Loading @@ -56,6 +56,8 @@ public: status_t appendFrom(const Parcel *parcel, status_t appendFrom(const Parcel *parcel, size_t start, size_t len); size_t start, size_t len); bool setAllowFds(bool allowFds); bool hasFileDescriptors() const; bool hasFileDescriptors() const; // Writes the RPC header. // Writes the RPC header. Loading Loading @@ -212,6 +214,7 @@ private: mutable bool mFdsKnown; mutable bool mFdsKnown; mutable bool mHasFds; mutable bool mHasFds; bool mAllowFds; release_func mOwner; release_func mOwner; void* mOwnerCookie; void* mOwnerCookie; Loading
include/utils/Errors.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -72,6 +72,7 @@ enum { TIMED_OUT = 0x80000005, TIMED_OUT = 0x80000005, UNKNOWN_TRANSACTION = 0x80000006, UNKNOWN_TRANSACTION = 0x80000006, #endif #endif FDS_NOT_ALLOWED = 0x80000007, }; }; // Restore define; enumeration is in "android" namespace, so the value defined // Restore define; enumeration is in "android" namespace, so the value defined Loading
libs/binder/Parcel.cpp +18 −1 Original line number Original line Diff line number Diff line Loading @@ -399,6 +399,8 @@ status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len) mDataPos += len; mDataPos += len; mDataSize += len; mDataSize += len; err = NO_ERROR; if (numObjects > 0) { if (numObjects > 0) { // grow objects // grow objects if (mObjectsCapacity < mObjectsSize + numObjects) { if (mObjectsCapacity < mObjectsSize + numObjects) { Loading Loading @@ -430,11 +432,21 @@ status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len) flat->handle = dup(flat->handle); flat->handle = dup(flat->handle); flat->cookie = (void*)1; flat->cookie = (void*)1; mHasFds = mFdsKnown = true; mHasFds = mFdsKnown = true; if (!mAllowFds) { err = FDS_NOT_ALLOWED; } } } } } } } return NO_ERROR; return err; } bool Parcel::setAllowFds(bool allowFds) { const bool origValue = mAllowFds; mAllowFds = allowFds; return origValue; } } bool Parcel::hasFileDescriptors() const bool Parcel::hasFileDescriptors() const Loading Loading @@ -759,6 +771,9 @@ restart_write: // remember if it's a file descriptor // remember if it's a file descriptor if (val.type == BINDER_TYPE_FD) { if (val.type == BINDER_TYPE_FD) { if (!mAllowFds) { return FDS_NOT_ALLOWED; } mHasFds = mFdsKnown = true; mHasFds = mFdsKnown = true; } } Loading Loading @@ -1283,6 +1298,7 @@ status_t Parcel::restartWrite(size_t desired) mNextObjectHint = 0; mNextObjectHint = 0; mHasFds = false; mHasFds = false; mFdsKnown = true; mFdsKnown = true; mAllowFds = true; return NO_ERROR; return NO_ERROR; } } Loading Loading @@ -1434,6 +1450,7 @@ void Parcel::initState() mNextObjectHint = 0; mNextObjectHint = 0; mHasFds = false; mHasFds = false; mFdsKnown = true; mFdsKnown = true; mAllowFds = true; mOwner = NULL; mOwner = NULL; } } Loading