sd/source/ui/remotecontrol/Receiver.cxx |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

New commits:
commit 99b8559471c4429df70803cdb358da41888f8d03
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Nov 17 15:22:37 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Nov 20 12:16:55 2023 +0100

    sd: remote: check that received commands have expected arguments
    
    Change-Id: If4b5fe0362a40d14d68829bffb79f91ae9745835
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159590
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 8d87164becccc230e1e0ad5ac51bf645744165a2)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159578
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sd/source/ui/remotecontrol/Receiver.cxx 
b/sd/source/ui/remotecontrol/Receiver.cxx
index 48d79e437d44..0846f5bbbe94 100644
--- a/sd/source/ui/remotecontrol/Receiver.cxx
+++ b/sd/source/ui/remotecontrol/Receiver.cxx
@@ -77,6 +77,12 @@ void Receiver::executeCommand( const std::vector<OString> 
&aCommand )
     {
     }
 
+    if (aCommand.empty())
+    {
+        SAL_WARN("sdremote", "Receiver::executeCommand: no command");
+        return;
+    }
+
     if ( aCommand[0] ==  "transition_next" )
     {
         if ( xSlideShowController.is() )
@@ -89,6 +95,11 @@ void Receiver::executeCommand( const std::vector<OString> 
&aCommand )
     }
     else if ( aCommand[0] == "goto_slide" )
     {
+        if (aCommand.size() < 2)
+        {
+            SAL_WARN("sdremote", "Receiver::executeCommand: invalid 
goto_slide");
+            return;
+        }
         // FIXME: if 0 returned, then not a valid number
         sal_Int32 aSlide = aCommand[1].toInt32();
         if ( xSlideShowController.is() &&
@@ -121,6 +132,11 @@ void Receiver::executeCommand( const std::vector<OString> 
&aCommand )
     }
     else if (aCommand[0] == "pointer_started" )
     {
+        if (aCommand.size() < 3)
+        {
+            SAL_WARN("sdremote", "Receiver::executeCommand: invalid 
pointer_started");
+            return;
+        }
         // std::cerr << "pointer_started" << std::endl;
         float x = aCommand[1].toFloat();
         float y = aCommand[2].toFloat();
@@ -175,6 +191,11 @@ void Receiver::executeCommand( const std::vector<OString> 
&aCommand )
     }
     else if (aCommand[0] == "pointer_coordination" )
     {
+        if (aCommand.size() < 3)
+        {
+            SAL_WARN("sdremote", "Receiver::executeCommand: invalid 
pointer_coordination");
+            return;
+        }
         float x = aCommand[1].toFloat();
         float y = aCommand[2].toFloat();
 

Reply via email to