aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColm Donelan <colm.donelan@arm.com>2022-03-08 11:57:41 +0000
committerColm Donelan <colm.donelan@arm.com>2022-03-08 15:00:36 +0000
commitfbe4594f9700ca13177fb1a36b82ede539f31e2f (patch)
treed2c366141b90b8b2461b00c8594877c127831542
parent8de9d4422f012d53f4136981ee22c30f28a96118 (diff)
downloadarmnn-fbe4594f9700ca13177fb1a36b82ede539f31e2f.tar.gz
IVGCVSW-6798 ArmNN driver profiling crashing
* Prevent a call to ExtractJsonObjects with an invalid value of parentObject. Signed-off-by: Colm Donelan <colm.donelan@arm.com> Change-Id: I279489c9ac3a954786f51bc90fb428db437cb2df
-rw-r--r--src/armnn/Profiling.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/armnn/Profiling.cpp b/src/armnn/Profiling.cpp
index e18bf475d1..805b61e8ef 100644
--- a/src/armnn/Profiling.cpp
+++ b/src/armnn/Profiling.cpp
@@ -345,10 +345,14 @@ void ExtractJsonObjects(unsigned int inferenceIndex,
parentObject.AddChild(childObject);
}
- // Recursively process children. In reality this won't be very deep recursion. ~4-6 levels deep.
- ExtractJsonObjects(inferenceIndex, childEvent, parentObject.GetChild(childIdx), descendantsMap);
-
- childIdx++;
+ // It's possible that childIdx can overrun the parents' child vector. Check before we try to process a
+ // non-existent child.
+ if (childIdx < parentObject.NumChildren())
+ {
+ // Recursively process children.
+ ExtractJsonObjects(inferenceIndex, childEvent, parentObject.GetChild(childIdx), descendantsMap);
+ childIdx++;
+ }
}
}
}