summaryrefslogtreecommitdiff
path: root/Parcel.cpp
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2019-09-30 09:03:07 -0700
committerSteven Moreland <smoreland@google.com>2019-09-30 18:11:07 +0000
commita46f1f84f682a775a33783875cfd1c05886778cf (patch)
tree9beefc74e2782b6977a39eabe5068a0e7e25bec2 /Parcel.cpp
parentd0d9a80e02fef97cec6a3c19a99f551a6891c389 (diff)
downloadlibhwbinder-a46f1f84f682a775a33783875cfd1c05886778cf.tar.gz
Fix segfault in readNullableNativeHandleNoDup.
Fixes: 141857065 Test: no longer segfaults w/ fuzzer repro Change-Id: Ib7016cc3def89e7a13c00580949f52c5d9cc4f72
Diffstat (limited to 'Parcel.cpp')
-rw-r--r--Parcel.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Parcel.cpp b/Parcel.cpp
index cfebeec..5aa8c77 100644
--- a/Parcel.cpp
+++ b/Parcel.cpp
@@ -1457,6 +1457,12 @@ status_t Parcel::readNullableNativeHandleNoDup(const native_handle_t **handle,
return status;
}
+ if (*handle == nullptr) {
+ // null handle already read above
+ ALOGE("Expecting non-null handle buffer");
+ return BAD_VALUE;
+ }
+
int numFds = (*handle)->numFds;
int numInts = (*handle)->numInts;