summaryrefslogtreecommitdiff
path: root/libs/binder/Parcel.cpp
diff options
context:
space:
mode:
author Marco Nelissen <marcone@google.com> 2016-05-09 21:05:18 +0000
committer android-build-merger <android-build-merger@google.com> 2016-05-09 21:05:18 +0000
commitc2c470c700a4e0fbbcd5b99da144f02cee7b9b3e (patch)
treeeeb26a4c03ba5d6ab6a82f11fef9f55cc7d55162 /libs/binder/Parcel.cpp
parent5ad8d443776e74a56e0e461ae6d333cf52e4f591 (diff)
parent82afbe2258c5c5e18ea6e9496d590cff177e67d4 (diff)
Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c72 am: 275c9f60f9 am: 853702ce3d am: 775f2e6dbf
am: 82afbe2258 * commit '82afbe2258c5c5e18ea6e9496d590cff177e67d4': Correctly handle dup() failure in Parcel::readNativeHandle Change-Id: I2c52991c2e6b1c5ef2eebbc4649b36c30dd9120d
Diffstat (limited to 'libs/binder/Parcel.cpp')
-rw-r--r--libs/binder/Parcel.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 87ce5d076e..ba7ccfc023 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1221,7 +1221,13 @@ native_handle* Parcel::readNativeHandle() const
for (int i=0 ; err==NO_ERROR && i<numFds ; i++) {
h->data[i] = dup(readFileDescriptor());
- if (h->data[i] < 0) err = BAD_VALUE;
+ if (h->data[i] < 0) {
+ for (int j = 0; j < i; j++) {
+ close(h->data[j]);
+ }
+ native_handle_delete(h);
+ return 0;
+ }
}
err = read(h->data + numFds, sizeof(int)*numInts);
if (err != NO_ERROR) {