From fbe4594f9700ca13177fb1a36b82ede539f31e2f Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Tue, 8 Mar 2022 11:57:41 +0000 Subject: IVGCVSW-6798 ArmNN driver profiling crashing * Prevent a call to ExtractJsonObjects with an invalid value of parentObject. Signed-off-by: Colm Donelan Change-Id: I279489c9ac3a954786f51bc90fb428db437cb2df --- src/armnn/Profiling.cpp | 12 ++++++++---- 1 file 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++; + } } } } -- cgit v1.2.1