Merge "Add support for file descriptors and vectors thereof" am: 8f237272e0
am: 0ebbd1ef19

* commit '0ebbd1ef19a4a4f6b0dfcc8d8d7c625ab5211f9d':
  Add support for file descriptors and vectors thereof
diff --git a/Parcel.cpp b/Parcel.cpp
index 0beea33..13ecc87 100644
--- a/Parcel.cpp
+++ b/Parcel.cpp
@@ -376,13 +376,11 @@
 
 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