svtools/source/svhtml/parhtml.cxx |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

New commits:
commit b8237d35d9f90d1dfdd35f24af8729d668029e2c
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Feb 28 14:17:55 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Feb 28 20:30:42 2024 +0100

    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.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

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;

Reply via email to