Fix integer overflow in unsafeReadTypedVector am: 65a8f07e57
am: 894ba10a5f
Change-Id: If93da0dbcbf78ea65e3ac950c5539861587526bb
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 1c355c4..2490b82 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -589,8 +589,16 @@
return UNEXPECTED_NULL;
}
+ if (val->max_size() < size) {
+ return NO_MEMORY;
+ }
+
val->resize(size);
+ if (val->size() < size) {
+ return NO_MEMORY;
+ }
+
for (auto& v: *val) {
status = (this->*read_func)(&v);