vcl/source/bitmap/BitmapPopArtFilter.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b0ad8a9175d5a9dddb9b853721905943c5cd8d59
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Mon Sep 19 14:22:32 2022 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Mon Sep 19 17:12:25 2022 +0200

    tdf#150992: fix crash popart filter to an SVG image
    
    part of bt:
    6  0x00007f018c80186f in BitmapPalette::operator[](unsigned short) const 
(this=0x5576a198fe48, nIndex=176) at vcl/source/bitmap/bitmappalette.cxx:139
    7  0x00007f018c3d1fce in BitmapInfoAccess::GetPaletteColor(unsigned short) 
const (this=0x5576a2bbc520, nColor=176) at include/vcl/BitmapInfoAccess.hxx:121
    8  0x00007f018c85b63f in BitmapPopArtFilter::execute(BitmapEx const&) const 
(this=0x7fffb7394728, rBitmapEx=...) at 
vcl/source/bitmap/BitmapPopArtFilter.cxx:73
    9  0x00007f018c83e66b in BitmapFilter::Filter(BitmapEx&, BitmapFilter 
const&) (rBmpEx=..., rFilter=...) at vcl/source/bitmap/bitmapfilter.cxx:22
    10 0x00007f01905e5bd4 in SvxGraphicFilter::ExecuteGrfFilterSlot(SfxRequest 
const&, GraphicObject&) (rReq=..., rFilterObject=...) at 
svx/source/dialog/grfflt.cxx:202
    
    some gdb info
    (gdb) p nIndex
    $1 = 176
    (gdb) p mpImpl->GetBitmapData().size()
    $2 = 34
    
    full bt here:
    https://bugs.documentfoundation.org/attachment.cgi?id=182499
    
    See https://bugs.documentfoundation.org/show_bug.cgi?id=150992#c2 for some 
comments
    
    the main thing that makes me think that the order is reversed is the 
"nLastEntry" treatment.
    Indeed with the current sort, mnCount with 0 come first nLastEntry = 
nEntryCount - 1 (unless there's no color at all)
    
    Change-Id: I3b89f2f4d6f115ea9f6752c49bad776a33f0b020
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140153
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/vcl/source/bitmap/BitmapPopArtFilter.cxx 
b/vcl/source/bitmap/BitmapPopArtFilter.cxx
index 5d5a6ee256ba..ce37c91fdd58 100644
--- a/vcl/source/bitmap/BitmapPopArtFilter.cxx
+++ b/vcl/source/bitmap/BitmapPopArtFilter.cxx
@@ -56,7 +56,7 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& 
rBitmapEx) const
             // sort table
             std::sort(aPopArtTable.begin(), aPopArtTable.end(),
                       [](const PopArtEntry& lhs, const PopArtEntry& rhs) {
-                          return lhs.mnCount < rhs.mnCount;
+                          return lhs.mnCount > rhs.mnCount;
                       });
 
             // get last used entry

Reply via email to