cid#1700598 - Guard the element probe against empty arrays
Change-Id: I7c887abae0aa4c830aac54ce3e9cee0d890757b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210333 Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Tested-by: Jenkins
This commit is contained in:
committed by
Andreas Heinisch
parent
d3d6804807
commit
319ac1ac8f
@@ -66,6 +66,20 @@ Sub verify_testSplit
|
||||
' - Actual : Object variable not set
|
||||
TestUtil.AssertEqual(oObject.TypeClass, 20, "CoreReflection.getType() for oObject.TypeClass after Split() + Array()")
|
||||
|
||||
' cid#1700598 - guard the element probe against empty arrays
|
||||
Dim aEmpty() As Integer
|
||||
' Without the fix in place, this assignment would have failed with
|
||||
' "Inadmissible value or data type. Index out of defined range"
|
||||
oObject = oReflection.GetType(aEmpty)
|
||||
TestUtil.AssertEqual(oObject.Name, "[]short", "CoreReflection.getType() for an empty Integer array")
|
||||
|
||||
' cid#1700598 - the element probe must use the dimension and not the flat storage index
|
||||
Dim aNegative(-5 To -1) As Integer
|
||||
' Without the fix in place, this assignment would have failed with
|
||||
' "Inadmissible value or data type. Index out of defined range"
|
||||
oObject = oReflection.GetType(aNegative)
|
||||
TestUtil.AssertEqual(oObject.Name, "[]short", "CoreReflection.getType() for an array with a negative lower bound")
|
||||
|
||||
' tdf#141474 keyword names need to match that of VBA
|
||||
TestUtil.AssertEqual(Split(expression:="LibreOffice StarOffice")(1), "StarOffice", "Split with 1 keyword name" )
|
||||
Dim txt As String : txt = "Libre_Office_Star_Office"
|
||||
|
||||
@@ -884,10 +884,11 @@ static Type getUnoTypeForSbxValue( const SbxValue* pVal )
|
||||
bool bNeedsInit
|
||||
= eElementTypeClass == TypeClass_VOID || eElementTypeClass == TypeClass_ANY;
|
||||
bool bInspectElements = bNeedsInit;
|
||||
if (!bInspectElements)
|
||||
// cid#1700598 - guard the element probe against empty arrays
|
||||
if (!bInspectElements && nLower <= nUpper)
|
||||
{
|
||||
sal_Int32 nFirstIdx = nLower;
|
||||
SbxVariableRef xFirstVar = pArray->Get(nFirstIdx);
|
||||
SbxVariableRef xFirstVar = pArray->Get(&nFirstIdx);
|
||||
if (xFirstVar && !xFirstVar->IsFixed())
|
||||
bInspectElements = true;
|
||||
}
|
||||
@@ -930,7 +931,8 @@ static Type getUnoTypeForSbxValue( const SbxValue* pVal )
|
||||
// tdf#146873 - inspect elements when they are non-fixed
|
||||
bool bNeedsInit = eElementTypeClass == TypeClass_VOID || eElementTypeClass == TypeClass_ANY;
|
||||
bool bInspectElements = bNeedsInit;
|
||||
if (!bInspectElements)
|
||||
// cid#1700598 - guard the element probe against empty arrays
|
||||
if (!bInspectElements && pArray->Count() > 0)
|
||||
{
|
||||
SbxVariableRef xFirstVar = pArray->SbxArray::Get(0);
|
||||
if (xFirstVar && !xFirstVar->IsFixed())
|
||||
|
||||
Reference in New Issue
Block a user