Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f91c66a9 authored by Marco Nelissen's avatar Marco Nelissen Committed by android-build-merger
Browse files

Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c am:...

Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c am: 275c9f60 am: 853702ce am: 775f2e6d am: 82afbe22 am: c2c470c7 am: 56dea281 am: bca20d83 am: a8244873
am: 93bf31f5

* commit '93bf31f5':
  Correctly handle dup() failure in Parcel::readNativeHandle

Change-Id: I436ae48cf652ac717ea74e2eff8a92359562e413
parents d2ebf374 93bf31f5
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1385,7 +1385,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) {