basic/source/runtime/methods.cxx |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 7419fc569f07fbd5685a6e58439b681a52fdd045
Author:     Alin Andrei Abahnencei <alinandrei2...@gmail.com>
AuthorDate: Mon Dec 23 10:56:39 2024 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Jan 9 13:19:13 2025 +0100

    tdf#154285 Check upper bound of arguments in SbRtl_Hour function
    
    Signed-off-by: Alin Andrei Abahnencei <alinandrei2...@gmail.com>
    Change-Id: Ib372b4dfde77961e7982bd0d8f1f8598be7da726
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179252
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 0c2b7c298cae..899a79cd90d5 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2042,16 +2042,11 @@ sal_Int16 implGetHour( double dDate )
 
 void SbRtl_Hour(StarBASIC *, SbxArray & rPar, bool)
 {
-    if (rPar.Count() < 2)
-    {
-        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-    }
-    else
-    {
-        double nArg = rPar.Get(1)->GetDate();
-        sal_Int16 nHour = implGetHour( nArg );
-        rPar.Get(0)->PutInteger(nHour);
-    }
+    if (rPar.Count() != 2)
+        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+    double nArg = rPar.Get(1)->GetDate();
+    sal_Int16 nHour = implGetHour( nArg );
+    rPar.Get(0)->PutInteger(nHour);
 }
 
 void SbRtl_Minute(StarBASIC *, SbxArray & rPar, bool)

Reply via email to