diff options
author | Steven Moreland <smoreland@google.com> | 2021-08-31 17:58:15 -0700 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2021-08-31 17:58:15 -0700 |
commit | a6318fd2985e03aa0540becfbf800be983460c04 (patch) | |
tree | c8f41421275af59870d5a9646778a1232939181f | |
parent | 0e4c9bc449c3a1cbf0e54cf6f30508e1aa21b551 (diff) | |
download | libhwbinder-a6318fd2985e03aa0540becfbf800be983460c04.tar.gz |
native handle - fix ubsan abort
missing bounds check
Fixes: 197919958
Test: hidl_test (while manually triggering ubsan)
Change-Id: I0234f56f0649b7bafec6f4e33509a93a3c739221
-rw-r--r-- | Parcel.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1464,8 +1464,8 @@ status_t Parcel::readNullableNativeHandleNoDup(const native_handle_t **handle, return status; } - if (nativeHandleSize < sizeof(native_handle_t)) { - ALOGE("Received a native_handle_t size that was too small."); + if (nativeHandleSize < sizeof(native_handle_t) || nativeHandleSize > std::numeric_limits<uint32_t>::max()) { + ALOGE("Invalid native_handle_t size: %" PRIu64, nativeHandleSize); return BAD_VALUE; } |