summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/binder/Parcel.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 74e75d74fc..bd2213d926 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -681,8 +681,16 @@ status_t Parcel::unsafeReadTypedVector(
return UNEXPECTED_NULL;
}
+ if (val->max_size() < size) {
+ return NO_MEMORY;
+ }
+
val->resize(static_cast<size_t>(size));
+ if (val->size() < size) {
+ return NO_MEMORY;
+ }
+
for (auto& v: *val) {
status = (this->*read_func)(&v);