From d30bfb5754501c8e7db2bd6b6d6d1f46768bb6b4 Mon Sep 17 00:00:00 2001 From: Matthew Sloyan Date: Sun, 18 Apr 2021 16:40:00 +0100 Subject: IVGCVSW-5829 Segfault in TfLiteDelegate * Updated Split function to read correct axis data. * Improved validation in Split and SplitV function. * Moved ComputeWrappedIndex function to DelegateUtils.hpp. Signed-off-by: Matthew Sloyan Change-Id: I8c7d0c9b747d1ab548df98da930d838c2f57659e --- delegate/src/DelegateUtils.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'delegate/src/DelegateUtils.hpp') diff --git a/delegate/src/DelegateUtils.hpp b/delegate/src/DelegateUtils.hpp index 1e5782ec42..deed61dc5f 100644 --- a/delegate/src/DelegateUtils.hpp +++ b/delegate/src/DelegateUtils.hpp @@ -554,4 +554,14 @@ TfLiteStatus ConnectConstant(armnn::IConnectableLayer* layer, return kTfLiteOk; } +unsigned int ComputeWrappedIndex(int index, unsigned int numDimensions) +{ + int numDims = armnn::numeric_cast(numDimensions); + int wrappedIndex = index < 0 ? numDims + index : index; + ARMNN_ASSERT(wrappedIndex >= 0); + ARMNN_ASSERT(wrappedIndex < numDims); + + return static_cast(wrappedIndex); +}; + } // namespace anonymous -- cgit v1.2.1