IVGCVSW-7901 Fix unsafe Usages of Memcpy in Armnn

* Updated usages of Memcpy to use proper checks for null instead of asserts
* Added error checking in places where none existed

Signed-off-by: David Monahan <david.monahan@arm.com>
Change-Id: I9529acd966466ba281f88918be2ec372a756e183
diff --git a/src/backends/backendsCommon/WorkloadUtils.cpp b/src/backends/backendsCommon/WorkloadUtils.cpp
index 3aea667..28d01ec 100644
--- a/src/backends/backendsCommon/WorkloadUtils.cpp
+++ b/src/backends/backendsCommon/WorkloadUtils.cpp
@@ -18,8 +18,14 @@
 armnn::ConstTensor PermuteTensor(const ConstTensorHandle* tensor,
                                  const PermutationVector& permutationVector, void* permuteBuffer)
 {
-    ARMNN_ASSERT_MSG(tensor, "Invalid input tensor");
-    ARMNN_ASSERT_MSG(permuteBuffer, "Invalid permute buffer");
+    if (tensor == nullptr)
+    {
+        throw armnn::InvalidArgumentException("WorkloadUtils: PermuteTensor: Null input tensor pointer");
+    }
+    if (permuteBuffer == nullptr)
+    {
+        throw armnn::InvalidArgumentException("WorkloadUtils: PermuteTensor: Null permute buffer pointer");
+    }
 
     TensorInfo tensorInfo = tensor->GetTensorInfo();
 
@@ -231,8 +237,14 @@
                                                      DataLayout dataLayout,
                                                      void* permuteBuffer)
 {
-    ARMNN_ASSERT_MSG(weightTensor, "Invalid input tensor");
-    ARMNN_ASSERT_MSG(permuteBuffer, "Invalid permute buffer");
+    if (weightTensor == nullptr)
+    {
+        throw armnn::InvalidArgumentException("WorkloadUtils: PermuteTensor: Null input tensor pointer");
+    }
+    if (permuteBuffer == nullptr)
+    {
+        throw armnn::InvalidArgumentException("WorkloadUtils: PermuteTensor: Null permute buffer pointer");
+    }
 
     auto multiplier    = weightTensor->GetTensorInfo().GetShape()[0];
     auto inputChannels = weightTensor->GetTensorInfo().GetShape()[1];