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

Commit 775f2e6d 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: 275c9f60

am: 853702ce

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

Change-Id: I2b8f6070ecc873d67be5a4c72ca870606af93a3d
parents 162fecdc 853702ce
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1223,7 +1223,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) {