Merge "Binder::Status: Add operator<< to help with gtest logging" am: 259eb56171
am: e4fe50ca42

* commit 'e4fe50ca421f0d8508a86f3b03f452d59136f5ae':
  Binder::Status: Add operator<< to help with gtest logging
diff --git a/Parcel.cpp b/Parcel.cpp
index 2e9e658..d3fe158 100644
--- a/Parcel.cpp
+++ b/Parcel.cpp
@@ -384,13 +384,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