[Libreoffice-commits] core.git: filter/source sd/qa

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 30 19:46:14 UTC 2021


 filter/source/graphicfilter/icgm/class4.cxx   |    7 ++++++-
 sd/qa/unit/data/cgm/fail/ofz35504-ubsan-1.cgm |binary
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 5e865370530a71eb966d2fbfc2fdfffc34d2e1b9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 29 21:27:18 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jun 30 21:45:35 2021 +0200

    ofz#35504 clamp input values in cgm filter
    
    Change-Id: I96712b8dc8f8eaad3fb8fa6710d0f07fff61b592
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118137
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
index 0a498426b3bc..697a466793bc 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -109,7 +109,12 @@ bool CGM::ImplGetEllipse( FloatPoint& rCenter, FloatPoint& rRadius, double& rAng
 
 static bool useless(double value)
 {
-    return std::isnan(value) || std::isinf(value);
+    if (!std::isfinite(value))
+        return true;
+    int exp;
+    std::frexp(value, &exp);
+    const int maxbits = sizeof(tools::Long) * 8;
+    return exp > maxbits;
 }
 
 void CGM::ImplDoClass4()
diff --git a/sd/qa/unit/data/cgm/fail/ofz35504-ubsan-1.cgm b/sd/qa/unit/data/cgm/fail/ofz35504-ubsan-1.cgm
new file mode 100644
index 000000000000..07aa3db00776
Binary files /dev/null and b/sd/qa/unit/data/cgm/fail/ofz35504-ubsan-1.cgm differ


More information about the Libreoffice-commits mailing list