diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-07-17 11:05:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-17 20:38:55 +0200 |
commit | 9e626a6d2a55a7159e4fd05d72275c7fe8bb0380 (patch) | |
tree | 8977a295d7bb6d87341208943a51df6e7c38a6e5 /editeng | |
parent | bd4ee5ea9b0b79cfb8c03aa1f1d6008565b71bff (diff) |
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@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/misc/txtrange.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
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) ) |