summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-11-17 15:22:37 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2023-11-24 21:58:22 +0100
commit1a1921ce8733ce95dab9f6e56ccdaf147fb75cb4 (patch)
treeddc1f415119b1ea95b3f17e460099056c771f415
parent6d721bac67e5d43fb1aeaa73b8a9a554d98843e1 (diff)
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.stahl@allotropia.de> (cherry picked from commit 8d87164becccc230e1e0ad5ac51bf645744165a2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159578 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 99b8559471c4429df70803cdb358da41888f8d03)
-rw-r--r--sd/source/ui/remotecontrol/Receiver.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx
index 3c0309e9e461..815c53ef4d35 100644
--- a/sd/source/ui/remotecontrol/Receiver.cxx
+++ b/sd/source/ui/remotecontrol/Receiver.cxx
@@ -78,6 +78,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() )
@@ -90,6 +96,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() &&
@@ -122,6 +133,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();
@@ -176,6 +192,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();