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

Commit dfefb3c7 authored by Nick Kralevich's avatar Nick Kralevich Committed by android-build-merger
Browse files

handle size_t > java max int size

am: cfe27dea

* commit 'cfe27dea':
  handle size_t > java max int size
parents d210ee62 cfe27dea
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -409,13 +409,11 @@ size_t Parcel::dataSize() const

size_t Parcel::dataAvail() const
{
    // TODO: decide what to do about the possibility that this can
    // report an available-data size that exceeds a Java int's max
    // positive value, causing havoc.  Fortunately this will only
    // happen if someone constructs a Parcel containing more than two
    // gigabytes of data, which on typical phone hardware is simply
    // not possible.
    return dataSize() - dataPosition();
    size_t result = dataSize() - dataPosition();
    if (result > INT32_MAX) {
        abort();
    }
    return result;
}

size_t Parcel::dataPosition() const