animations/source/animcore/animcore.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d1cdf9a24de0d87f22e283f5cb2ed93ff6e83ee6
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Tue May 31 20:35:26 2022 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Tue May 31 22:42:14 2022 +0200

    Also assert that nNodeType is non-negative
    
    ...given that nNodeType aka AnimationNode::mnNodeType is later used as an 
index
    into the AnimationNode::mpTypes array
    
    Change-Id: Ic208fbdfaa8dcca44ff2a99cf3b169904b14a4bf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135203
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/animations/source/animcore/animcore.cxx 
b/animations/source/animcore/animcore.cxx
index c02ba3ca2878..737da604a594 100644
--- a/animations/source/animcore/animcore.cxx
+++ b/animations/source/animcore/animcore.cxx
@@ -55,6 +55,7 @@
 
 #include <cppuhelper/implbase.hxx>
 
+#include <o3tl/safeint.hxx>
 #include <osl/mutex.hxx>
 #include <sal/log.hxx>
 #include <array>
@@ -446,7 +447,7 @@ AnimationNode::AnimationNode( sal_Int16 nNodeType )
     mnIterateType( css::presentation::ShapeAnimationSubType::AS_WHOLE ),
     mfIterateInterval(0.0)
 {
-    assert(nNodeType < int(mpTypes.size()));
+    assert(nNodeType >= 0 && o3tl::make_unsigned(nNodeType) < mpTypes.size());
 }
 
 AnimationNode::AnimationNode( const AnimationNode& rNode )

Reply via email to