Resolves: tdf#164124 Do not trap incomplete date 2021-6/1 as fraction

In fact do not accept anything else than blanks after integer
portion for a fraction.

Change-Id: I29746bb7cd78ecc6a7810e8841bee748589a36e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177899
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
This commit is contained in:
Eike Rathke 2024-12-05 19:17:54 +01:00
parent f232952e72
commit 6926c820ce

View file

@ -2564,6 +2564,20 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString )
}
static bool lcl_isBlanks( const OUString& rStr )
{
if (rStr.isEmpty())
return false;
for (sal_Int32 i = rStr.getLength(); i-- > 0; )
{
if (rStr[i] != ' ')
return false;
}
return true;
}
/**
* Analyze string in the middle
* All gone => true
@ -2665,8 +2679,9 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, sal_uInt16 nS
(nNumericsCnt == 3 && // or 3 numbers
(nStringPos == 3 || // and 4th string particle
(nStringPos == 4 && nSign)) && // or 5th if signed
sStrArray[nStringPos-2].indexOf('/') == -1))) // and not 23/11/1999
// that was not accepted as date yet
lcl_isBlanks(sStrArray[nStringPos-2])))) // and not 23/11/1999
// that was not accepted as date yet,
// nor anything else than blanks after integer.
{
SkipBlanks(rString, nPos);
if (nPos == rString.getLength())