vcl/inc/salbmp.hxx           |    3 ++-
 vcl/source/bitmap/salbmp.cxx |    5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 29c5b99832d731071dd201e88d6631c805efe91a
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Fri Dec 18 11:59:25 2020 +0100
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Dec 18 21:20:03 2020 +0100

    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.gran...@collabora.co.uk>

diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index 943f9d6b2986..adbf70e5c17f 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 880be0bb437b..7159ac3d5a6b 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
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to