fix incorrect array access after a removed enum (tdf#138973)
c521e614359d236405754134a54e8a05bdb1c44c removed some enum values
but didn't remove them from the conversion array.
Change-Id: Idf4837c5929feefb11b400fcd1036370534ed26a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107961
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index 943f9d6..adbf70e 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -121,7 +121,8 @@ protected:
{
A8,
RGBA,
BGRA
BGRA,
LAST = BGRA
};
static std::unique_ptr< sal_uInt8[] > convertDataBitCount( const sal_uInt8* src,
int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette,
diff --git a/vcl/source/bitmap/salbmp.cxx b/vcl/source/bitmap/salbmp.cxx
index 880be0b..7159ac3 100644
--- a/vcl/source/bitmap/salbmp.cxx
+++ b/vcl/source/bitmap/salbmp.cxx
@@ -18,6 +18,7 @@
*/
#include <salbmp.hxx>
#include <o3tl/enumarray.hxx>
static BitmapChecksum scanlineChecksum(BitmapChecksum nCrc, const sal_uInt8* bits, int lineBitsCount, sal_uInt8 extraBitsMask)
{
@@ -264,8 +265,8 @@ std::unique_ptr< sal_uInt8[] > SalBitmap::convertDataBitCount( const sal_uInt8*
int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, BitConvert type )
{
assert( bitCount == 1 || bitCount == 4 || bitCount == 8 );
static const int bpp[] = { 1, 3, 3, 4, 4 };
std::unique_ptr< sal_uInt8[] > data( new sal_uInt8[width * height * bpp[ static_cast<int>(type) ]] );
static const o3tl::enumarray<BitConvert, int> bpp = { 1, 4, 4 };
std::unique_ptr< sal_uInt8[] > data( new sal_uInt8[width * height * bpp[ type ]] );
if(type == BitConvert::A8 && bitCount == 8 && palette.IsGreyPalette8Bit())
{ // no actual data conversion