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

Commit 1009de5a 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 am: f91c66a9
am: fb6342d2

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

Change-Id: I0c9e0506c4e8c55234373b1158428b122f4fcb6f
parents f29318d0 fb6342d2
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1964,7 +1964,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) {