[Libreoffice-commits] core.git: editeng/source
Stephan Bergmann
sbergman at redhat.com
Fri Mar 16 01:31:07 UTC 2018
editeng/source/items/borderline.cxx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit 2537d6897ae516d3b4d50f0e2885dc24949841bf
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Mar 15 17:13:13 2018 +0100
Clip BColor lightness value at 1.0
UBSan build started to fail CppunitTest_sw_ooxmlexport8 with
> /include/tools/color.hxx:59:27: runtime error: value 258.5 is outside the range of representable values of type 'unsigned char'
> #0 0x2ad219182418 in Color::Color(basegfx::BColor const&) /include/tools/color.hxx:59:27
> #1 0x2ad219175e48 in (anonymous namespace)::lcl_compute3DColor(Color, int, int, int) /editeng/source/items/borderline.cxx:50:16
> #2 0x2ad219175574 in editeng::SvxBorderLine::threeDLightColor(Color) /editeng/source/items/borderline.cxx:77:12
> #3 0x2ad21917ea78 in editeng::SvxBorderLine::GetColorOut(bool) const /editeng/source/items/borderline.cxx:573:23
where lcl_compute3DColor had been called with (aMain=rgba(255, 255, 255, 255),
nLight=3, nMedium=40, nDark=83)
Change-Id: I0f4569d9fd9f54164efe395960bcc8a6840e7744
Reviewed-on: https://gerrit.libreoffice.org/51351
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index 70b768a0acc4..ab032bcc043a 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <algorithm>
+
#include <basegfx/color/bcolor.hxx>
#include <basegfx/color/bcolortools.hxx>
@@ -43,7 +47,7 @@ namespace {
else
nCoef = nDark;
- double L = hsl.getZ() * 255.0 + nCoef;
+ double L = std::min(hsl.getZ() * 255.0 + nCoef, 255.0);
hsl.setZ( L / 255.0 );
color = basegfx::utils::hsl2rgb( hsl );
More information about the Libreoffice-commits
mailing list