diff options
author | Mike Kelly <mike.kelly@arm.com> | 2022-05-06 12:14:16 +0100 |
---|---|---|
committer | mike.kelly <mike.kelly@arm.com> | 2022-05-06 19:26:17 +0000 |
commit | 84d63785eb2dceba297a685ebd98f1d29be47326 (patch) | |
tree | efc28e6c28df26bdf946de7923c4b2b554913e1d /delegate/src/DelegateUtils.hpp | |
parent | 727c2b577fb2df7d433866792f1561af4ce43505 (diff) | |
download | armnn-84d63785eb2dceba297a685ebd98f1d29be47326.tar.gz |
IVGCVSW-6929 Fix for segfault in tflite delegate
* It's possible that a model may have an input entry for bias tensors
but that the index for those is -1. If it's -1 then it's not present.
* Fixed logic error in IsOptionalOperandPresent: it returned false if
it was present and true if it was missing.
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: I45ad8d8552122493c529b1a35a5689416ccfbb71
Diffstat (limited to 'delegate/src/DelegateUtils.hpp')
-rw-r--r-- | delegate/src/DelegateUtils.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/delegate/src/DelegateUtils.hpp b/delegate/src/DelegateUtils.hpp index e0ba1cf4e7..46b2db9d64 100644 --- a/delegate/src/DelegateUtils.hpp +++ b/delegate/src/DelegateUtils.hpp @@ -586,11 +586,13 @@ TfLiteStatus ConnectConstant(armnn::IConnectableLayer* layer, bool IsOptionalOperandPresent(TfLiteNode* tfLiteNode, const int operandIndex) { - if (tfLiteNode->inputs->data[operandIndex] < 0) { + // If the inputs array has fewer than operandIndex entries or if the entry at operandIndex has a value of -1 or + // less then the input is not present. + if (tfLiteNode->inputs->size > operandIndex && tfLiteNode->inputs->data[operandIndex] >= 0) + { return true; } return false; - } TfLiteStatus ProcessInputs(armnn::IConnectableLayer* layer, |