summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-28 14:17:55 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-28 20:30:42 +0100
commitb8237d35d9f90d1dfdd35f24af8729d668029e2c (patch)
tree77a310a8f581818fc5d759a5ed8a182bc6aa9573
parentfd0247ad59782523fd81f8a84b7a67258f853461 (diff)
ofz#67092 Integer-overflow
Change-Id: I74a5218b44de06b06e8c16493e76992e496527d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164098 Tested-by: Jenkins Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--svtools/source/svhtml/parhtml.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 1f8745674469..b2620b5a49e6 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -2073,14 +2073,16 @@ bool HTMLParser::ParseMetaOptionsImpl(
if (comphelper::string::getTokenCount(aContent, ';') == 2)
{
sal_Int32 nIdx{ 0 };
- Date aDate(o3tl::toInt32(o3tl::getToken(aContent, 0, ';', nIdx)));
- auto nTime = o3tl::toInt64(o3tl::getToken(aContent, 0, ';', nIdx));
- if (nTime < 0)
- nTime = o3tl::saturating_toggle_sign(nTime);
- tools::Time aTime(nTime);
- DateTime aDateTime(aDate, aTime);
- uDT = aDateTime.GetUNODateTime();
- valid = true;
+ sal_Int32 nDate = o3tl::toInt32(o3tl::getToken(aContent, 0, ';', nIdx));
+ sal_Int64 nTime = o3tl::toInt64(o3tl::getToken(aContent, 0, ';', nIdx));
+ valid = nDate != std::numeric_limits<sal_Int32>::min() &&
+ nTime != std::numeric_limits<sal_Int64>::min();
+ if (valid)
+ {
+ Date aDate(nDate);
+ tools::Time aTime(nTime);
+ uDT = DateTime(aDate, aTime).GetUNODateTime();
+ }
}
else if (utl::ISO8601parseDateTime(aContent, uDT))
valid = true;