unotools/source/misc/datetime.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 8fb464bc100bc0c8190a3147db1939df37f42929
Author: Lionel Elie Mamane <lio...@mamane.lu>
Date:   Thu Jun 27 19:47:02 2013 +0200

    fix crash when parsing empty string
    
    the parsing of the hours would succeed, but the parsing of the minutes 
would access past-the-end of the string.
    Probably same crash when parsing HH or HHMM formats.
    
    Change-Id: I248810e5c4c425186f33e573634883263caff312
    Reviewed-on: https://gerrit.libreoffice.org/4591
    Reviewed-by: Fridrich Strba <fridr...@documentfoundation.org>
    Tested-by: Fridrich Strba <fridr...@documentfoundation.org>

diff --git a/unotools/source/misc/datetime.cxx 
b/unotools/source/misc/datetime.cxx
index 93f60a6..b383dc5 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -424,8 +424,11 @@ bool ISO8601parseTime(const OUString &aTimeStr, 
starutil::Time& rTime)
                 }
                 goto end;
             }
+            if(n >= aTimeStr.getLength())
+                goto end;
         }
     }
+
     // minutes
     if (bSuccess && (bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, 
bFrac, tokFrac)))
     {
@@ -452,12 +455,14 @@ bool ISO8601parseTime(const OUString &aTimeStr, 
starutil::Time& rTime)
                 }
                 goto end;
             }
+            if(n >= aTimeStr.getLength())
+                goto end;
         }
     }
     // seconds
     if (bSuccess && (bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, 
bFrac, tokFrac)))
     {
-        if ( bFrac && n < aTimeStr.getLength())
+        if (n < aTimeStr.getLength())
             // junk after ISO time
             bSuccess = false;
         // max 60 for leap seconds
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to