[Libreoffice-commits] core.git: basic/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 13 13:15:19 UTC 2018


 basic/source/runtime/methods.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b05470083a5a6f35a2c820500c823afadba804f0
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Nov 13 08:14:57 2018 +0100
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Tue Nov 13 14:14:56 2018 +0100

    Don't call Date's ImpYearToDays with zero year argument
    
    ...on which it asserts since 6d4f2dcc7cbba771e9d9b00de50368db4a88ef1b "Resolves:
    tdf#100452 class Date full (BCE,CE) proleptic Gregorian calendar".
    
    The assert fired when executing the Basic code from attachment 146529 to
    <https://bugs.documentfoundation.org/show_bug.cgi?id=121337>
    "FileDateTime("\\nonexistent\smb\path") returns bogus result rather than
    throwing error":
    
    > #4  0x00007ffff1d1c830 in (anonymous namespace)::ImpYearToDays(short) (nYear=0) at tools/source/datetime/tdate.cxx:55
    > #5  0x00007ffff1d1c449 in Date::DateToDays(unsigned short, unsigned short, short) (nDay=0, nMonth=0, nYear=0) at tools/source/datetime/tdate.cxx:149
    > #6  0x00007ffff1d1c3e5 in Date::GetAsNormalizedDays() const (this=0x7fffffff7268) at tools/source/datetime/tdate.cxx:142
    > #7  0x00007ffff1d1dae5 in operator-(Date const&, Date const&) (rDate1=1900-1-1, rDate2=0-0-0) at tools/source/datetime/tdate.cxx:581
    > #8  0x00007ffff5f87347 in GetDayDiff(Date const&) (rDate=0-0-0) at basic/source/runtime/methods.cxx:4653
    > #9  0x00007ffff5f8aebb in SbRtl_FileDateTime(StarBASIC*, SbxArray&, bool) (rPar=...) at basic/source/runtime/methods.cxx:3054
    
    Change-Id: I6468eeafc3daf325d3da3dfeacd08c7df1d1a8f4
    Reviewed-on: https://gerrit.libreoffice.org/63318
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 6d10a1a92edd..20348c850839 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3051,7 +3051,7 @@ void SbRtl_FileDateTime(StarBASIC *, SbxArray & rPar, bool)
             aDate = Date( aDT.Day, aDT.Month, aDT.Year );
         }
 
-        double fSerial = static_cast<double>(GetDayDiff( aDate ));
+        double fSerial = aDate.IsEmpty() ? 0 : static_cast<double>(GetDayDiff( aDate ));
         long nSeconds = aTime.GetHour();
         nSeconds *= 3600;
         nSeconds += aTime.GetMin() * 60;


More information about the Libreoffice-commits mailing list