IVGCVSW-7900 Added parameter checks to executeFenced
* Added parameter checks to ensure that the native_handles will work
with this function.
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: I0f07de04b24f930d8025461178ba4cdb470eb5b4
diff --git a/ArmnnPreparedModel_1_3.cpp b/ArmnnPreparedModel_1_3.cpp
index ceeb3c4..1827d90 100644
--- a/ArmnnPreparedModel_1_3.cpp
+++ b/ArmnnPreparedModel_1_3.cpp
@@ -434,6 +434,21 @@
auto fenceNativeHandle = fenceWaitFor[index].getNativeHandle();
if (!fenceNativeHandle)
{
+ ALOGE("ArmnnPreparedModel_1_3::executeFenced null native handle.");
+ cb(V1_3::ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
+ return Void();
+ }
+
+ if (fenceNativeHandle->numFds != 1)
+ {
+ ALOGE("ArmnnPreparedModel_1_3::executeFenced invalid fenceHandle numFds.");
+ cb(V1_3::ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
+ return Void();
+ }
+
+ if (fenceNativeHandle->numInts != 0)
+ {
+ ALOGE("ArmnnPreparedModel_1_3::executeFenced invalid fenceHandle numInts.");
cb(V1_3::ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
return Void();
}