From cddb28b591ca8d27a7ae9bc36cdb108f4ad021ee Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 1 Sep 2023 15:56:01 +0200 Subject: tdf#156126: fix crash when using gpl color palette keep the do/while instead of a plain while since: 1) you'll always got a empty line since aLine isn't initialized 2) some palette may contain empty line eg: "Office 2016" palette from https://extensions.libreoffice.org/en/extensions/show/o2k10-color-palette Change-Id: I2874261b8dd13ce180ed05628b11bd3efce6720c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156421 Reviewed-by: Julien Nabet Tested-by: Julien Nabet (cherry picked from commit 46022e5fcdf01db60c0c560cbd2aff9b7a57a372) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156439 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- svx/source/tbxctrls/Palette.cxx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'svx') diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx index 8c81eb53167e..b3f1965de31b 100644 --- a/svx/source/tbxctrls/Palette.cxx +++ b/svx/source/tbxctrls/Palette.cxx @@ -262,6 +262,9 @@ void PaletteGPL::LoadPalette() OStringBuffer aLine; do { + if (aLine.isEmpty()) + continue; + if (aLine[0] != '#' && aLine[0] != '\n') { // TODO check if r,g,b are 0<= x <=255, or just clamp? -- cgit