Bug 158224 - EDITING CRASH Cannot convert bitmap to polygons
Summary: EDITING CRASH Cannot convert bitmap to polygons
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha0+
Hardware: x86-64 (AMD64) All
: medium critical
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0 target:7.6.4
Keywords: bibisected, bisected, haveBacktrace, regression
Depends on:
Blocks: Crash
  Show dependency treegraph
 
Reported: 2023-11-15 14:22 UTC by Frank Reibold
Modified: 2023-11-22 07:45 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample drawing saved as PNG (6.00 KB, image/png)
2023-11-15 14:22 UTC, Frank Reibold
Details
gdb backtrace with 24.2 alpha0+ debug build on Ubuntu 20.04 (213.43 KB, text/x-log)
2023-11-15 16:03 UTC, Stéphane Guillou (stragu)
Details
800x600.bmp (1.37 MB, image/bmp)
2023-11-16 05:34 UTC, Frank Reibold
Details
800x600.jpg (104.85 KB, image/jpeg)
2023-11-16 05:34 UTC, Frank Reibold
Details
bt with debug symbols (16.09 KB, text/plain)
2023-11-16 09:39 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Reibold 2023-11-15 14:22:25 UTC
Created attachment 190841 [details]
Sample drawing saved as PNG

LibreOffice Draw 7.6.2 crashes whan I try to convert a bitmap to polygons.

To replicate the bug do the following:

(1) Create a drawing and export it to PNG
(2) Open the PNG with LO Draw
(3) Select "Convert to polygons" from the context menu

Result: LO Draw crashes :-(

OpenOffice Draw 4.1.14 doesn't crash.
Comment 1 Frank Reibold 2023-11-15 14:34:22 UTC
Tested on Windows 10 and Windows 11.
Comment 2 Stéphane Guillou (stragu) 2023-11-15 16:03:06 UTC
Reproduced in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 92e5898fa9ffa4dd8742f5f26e790563feef286e
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Version: 7.6.3.1 (X86_64) / LibreOffice Community
Build ID: c4af5b1259bceea6e979e6fe2435dbee7a5a87c2
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

No repro in:

Version: 7.5.8.2 (X86_64) / LibreOffice Community
Build ID: f718d63693263970429a68f568db6046aaa9df01
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 3 Stéphane Guillou (stragu) 2023-11-15 16:03:58 UTC
Created attachment 190843 [details]
gdb backtrace with 24.2 alpha0+ debug build on Ubuntu 20.04

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 3aca2d9776a871f15009a1aa70628ba3a03ee147
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 4 Stéphane Guillou (stragu) 2023-11-15 16:35:56 UTC
Bibisected with linux-64-7.6 repo to first bad build commit [b9559709ad7e1b0cc228ab286e0d18275bd4a82e] which points to core commit:

commit a76a135c9e9bdecd38970e293e72eeeeca000d27
author	Noel Grandin 	Tue Jan 03 20:14:21 2023 +0200
committer	Noel Grandin 	Wed Jan 04 15:35:56 2023 +0000
flatten some vcl code
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145017

Noel, can you please have a look?
Comment 5 Regina Henschel 2023-11-15 17:05:15 UTC
I have tested it with current master on Windows 10. Converting a bmp-image does not crash. Converting a png-image crashes in

    sal_uInt16 GetPaletteEntryCount() const
    {
        const BitmapBuffer* pBuffer = mpBuffer;

        assert(HasPalette() && "Bitmap has no palette!");

        return HasPalette() ? pBuffer->maPalette.GetEntryCount() : 0;
    }

in include/vcl/BitmapInfoAccess.hxx

coming from
vcllo.dll!BitmapInfoAccess::GetPaletteEntryCount() Line 110	C++

vcllo.dll!ImplVectorizer::ImplVectorize(const Bitmap & rColorBmp, GDIMetaFile & rMtf, unsigned char cReduce, const Link<__int64,void> * pProgress) Line 660	C++

vcllo.dll!Bitmap::Vectorize(GDIMetaFile & rMtf, unsigned char cReduce, const Link<__int64,void> * pProgress) Line 1499	C++
Comment 6 Frank Reibold 2023-11-16 05:32:53 UTC
With LibrerOffice 7.6, 800x600.jpg and 800x600.bmp cause Draw to crash. OpenOffice can convert them.
Comment 7 Frank Reibold 2023-11-16 05:34:00 UTC
Created attachment 190854 [details]
800x600.bmp

BMP causes LO Draw to crash
Comment 8 Frank Reibold 2023-11-16 05:34:43 UTC
Created attachment 190855 [details]
800x600.jpg

JPG causes LO Draw to crash
Comment 9 Julien Nabet 2023-11-16 09:39:44 UTC
Created attachment 190858 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I got an assertion when giving a try with https://bugs.documentfoundation.org/attachment.cgi?id=190854
Comment 10 Commit Notification 2023-11-16 10:52:05 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b0c68499ab36d2a1bdf6f1bc7d4cd259b99700e7

tdf#158224 Cannot convert bitmap to polygons

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Julien Nabet 2023-11-16 13:04:51 UTC
I confirm I don't reproduce the assertion and everything works thanks to Noel's fix.
Comment 12 Commit Notification 2023-11-20 14:53:57 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/335ff17176a83abec91dc925a3339e354a1aded8

tdf#158224 Cannot convert bitmap to polygons

It will be available in 7.6.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Frank Reibold 2023-11-22 07:45:14 UTC
I confirm that the bug has been fixed.

LibreOffice 24.2.0.0 alpha (22 Nov 2023 daily build for Windows)