diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-06-27 19:47:02 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-06-27 19:52:43 +0200 |
commit | 667ef4356af609a6d54edf88ffbdf054509272f3 (patch) | |
tree | 848f666b6373f17b84154fd2b3be466fc91fd417 /unotools | |
parent | 001adf630c650b22f2535cc76f90b426a53ad754 (diff) |
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
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/misc/datetime.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx index 93f60a6e007e..b383dc587709 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 |