diff options
author | Alin Andrei Abahnencei <alinandrei2004@gmail.com> | 2024-12-23 10:58:57 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2025-01-09 13:17:02 +0100 |
commit | 633a787707786de7a535070efbd81781430395e7 (patch) | |
tree | 73fa2ae3a82d5823c7ba026c0a94a6665dd4c7aa | |
parent | e08ed1d92f083cc604cb25eb284deb21016268fd (diff) |
tdf#154285 Check upper bound of arguments in SbRtl_Day function
Signed-off-by: Alin Andrei Abahnencei <alinandrei2004@gmail.com>
Change-Id: Ic22d420f0f5596ea3a4ff9cd7e540e6c51a559ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179254
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | basic/source/runtime/methods.cxx | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 17b9029b9d72..3c353bdd4256 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -2015,18 +2015,13 @@ void SbRtl_TimeValue(StarBASIC *, SbxArray & rPar, bool) void SbRtl_Day(StarBASIC *, SbxArray & rPar, bool) { - if (rPar.Count() < 2) - { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - } - else - { - SbxVariableRef pArg = rPar.Get(1); - double aDate = pArg->GetDate(); + if (rPar.Count() != 2) + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + SbxVariableRef pArg = rPar.Get(1); + double aDate = pArg->GetDate(); - sal_Int16 nDay = implGetDateDay( aDate ); - rPar.Get(0)->PutInteger(nDay); - } + sal_Int16 nDay = implGetDateDay( aDate ); + rPar.Get(0)->PutInteger(nDay); } void SbRtl_Year(StarBASIC *, SbxArray & rPar, bool) |