[Libreoffice-commits] core.git: editeng/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 17 18:39:29 UTC 2021


 editeng/source/misc/txtrange.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 9e626a6d2a55a7159e4fd05d72275c7fe8bb0380
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Jul 17 11:05:56 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 17 20:38:55 2021 +0200

    blind fix for ubsan div/0
    
    Change-Id: I0ee929c79d5ac94299adc84ba91d6b0683a8193d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119095
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
index b8c46e0cdcba..dadc4fc6f315 100644
--- a/editeng/source/misc/txtrange.cxx
+++ b/editeng/source/misc/txtrange.cxx
@@ -194,7 +194,10 @@ tools::Long SvxBoundArgs::CalcMax( const Point& rPt1, const Point& rPt2,
         nB = nStart;
     nB *= nB;
     nB += nDa * nDa;
-    nB = nRange + nDa * ( nFarRange - nRange ) / sqrt( nB );
+    nB = sqrt( nB );
+    if (nB == 0) // avoid div / 0
+        return 0;
+    nB = nRange + nDa * ( nFarRange - nRange ) / nB;
 
     bool bNote;
     if( nB < B(rPt2) )


More information about the Libreoffice-commits mailing list