Bug 135952 - Using 'points' in PNG export dialog causes absurdly large images and possible crash
Summary: Using 'points' in PNG export dialog causes absurdly large images and possible...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.0.0.3 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.1.0 target:7.0.3
Keywords: haveBacktrace
Depends on:
Blocks: Graphics-Export
  Show dependency treegraph
 
Reported: 2020-08-20 16:18 UTC by bram.bugzilla
Modified: 2020-10-09 21:49 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
bt with debug symbols (24.38 KB, text/plain)
2020-08-23 10:17 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bram.bugzilla 2020-08-20 16:18:41 UTC
Description:
When trying to export anything in libreoffice draw , I first get the file dialog and select a file name (I have it for png and gif, have not tried others), file type and I select 'Selection'. Then when pressing Save you get some extra options but no matter what I click there the application freezes and gets shut down. 

OS Windows 10, Fresh install of 7.0.0.3 after I also had the problem with the version I had I uninstalled it and reinstalled latest version (old version was 6.4 something)

Crash report: crashreport.libreoffice.org/stats/crash_details/260b5a49-7df9-4e01-8b02-b5f749250b9a

Steps to Reproduce:
1. Draw something
2. Select drawn items
3. File>Export, choose file name and select 'Selection'
4. Next dialog will freeze when clicking anything

Actual Results:
Application freeze and exit

Expected Results:
png/gif file is created


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.0.0.3 (x64)
Build ID: 8061b3e9204bef6b321a21033174034a5e2ea88e
CPU threads: 8; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 1 Julien Nabet 2020-08-20 18:14:12 UTC
I see Skia in the crashreport so let's link it to tdf#129062.
Comment 2 Telesto 2020-08-21 07:29:13 UTC
To be certain the reported issue is not related to corruption in the user profile, could you please reset your Libreoffice profile ( https://wiki.documentfoundation.org/UserProfile ) and re-test?
Comment 3 Luboš Luňák 2020-08-21 09:59:16 UTC
I cannot reproduce. Please provide a test document, and also a screenshot of the settings in the dialog.
Comment 4 bram.bugzilla 2020-08-21 10:19:30 UTC
I will try resetting the user profile later today, currently I have no access to the machine.
Can I disable Skia somehow to verify that it is Skia related (not sure if that is a stupid question, not really familiar with what Skia does) ?

For the test document: I don't think the contents matter, I first had it with the (complex) document I was working on, but then for testing I just restarted, started from a blank page, added a rectangle (default light blue filling if I recall correctly) and did an export of the rectangle and it still crashed (i did not save that document, but I can redo it and save one for you ).  For the dialog, you mean the one you get after you click save on the first export file name window right ? I did not change any settings there, I can't , as soon as I click anything in that dialog box it freezes.
Comment 5 Luboš Luňák 2020-08-21 13:15:23 UTC
(In reply to bram.bugzilla from comment #4)
> Can I disable Skia somehow to verify that it is Skia related (not sure if
> that is a stupid question, not really familiar with what Skia does) ?

Tools->Options->LibreOffice->View->Graphics Output.

> For the dialog, you mean the one you get after you click save on
> the first export file name window right ? I did not change any settings
> there, I can't , as soon as I click anything in that dialog box it freezes.

Yes, the dialog that freezes. A screenshot of it should do.
Comment 6 bram.bugzilla 2020-08-21 14:04:22 UTC
Hi, 

Ok so when starting in safe mode the problem is gone. 

But experimenting a bit more shows it is not that my user profile is corrupted, but that I have selected 'points' as my unit of measurement (in Options>Libreoffice Draw>General).

If i put that on mm then it works, if i put it on point it crashes. 
(the reason I took points is that I was hoping it would be easy to map points to pixels as I am trying to make 320x240 pixel screens for an embedded SW device, but that does not seem to be the case so there is no point (phun intended) in retrospect )

The png dialog shows some weird values for the size too, probably that is related.

Hope this helps in fixing the problem.

Edit: I tried to do 'add an attachment' with a zip file of the project and screenshots but I get an error the attachment is invalid.
I hope you can reproduce the problem with the steps above and the screenshots are not necessary, if not, let me know!


Regards
Bram
Comment 7 Julien Nabet 2020-08-23 10:17:04 UTC
Created attachment 164588 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I could reproduce this.

I had to select "point" and gen rendering.
Comment 8 Telesto 2020-08-23 10:20:19 UTC
(In reply to Julien Nabet from comment #7)
> Created attachment 164588 [details]
> bt with debug symbols
> 
> On pc Debian x86-64 with master sources updated today, I could reproduce
> this.
> 
> I had to select "point" and gen rendering.

Still not crashing for me
Version: 7.1.0.0.alpha0+ (x64)
Build ID: 8700bace8c0714d853f5df6918ab9c8bb3d81f77
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 9 bram.bugzilla 2020-08-23 20:21:10 UTC
I tried on a windows 7 system too. 
Initially I had 6.4.something on there and it did not crash (I noticed UI render was set to default in the about screen). 
(I still could not export to gif though, I get an error box 'Image filter not found' which seems to be related to this bug : https://www.mail-archive.com/libreoffice-bugs@lists.freedesktop.org/msg630942.html. )

Then I installed 7.0.0.3 and then it crashes.
If I disable Skia (unselect in Tools->Options->LibreOffice->View->Graphics Output and restart) then it does not crash anymore, but I do get the 'Image filter not found' error again for gif export, and for png export. 

I also noticed that the behavior of the dialog that freezes is erratic with respect to the size fields for the non crashing scenario.
Eg I have drawn a box of 136.1 x 150 points
I do export, selection and i get a size of 135.73 x 149.98 points, 37 pixel/cm which is a bit unexpected but maybe there are some conversion errors along the way somewhere ?
But as soon as this dialog looses focus the values jump to 99999,99 x 99999,99 points.
And If try to press the up/down buttons of the width then the height all of a sudden becomes 0,00.
Trying to enter an actual value there makes everything hang for a while (after pressing enter in the width box) after which the screen just disappears and I go back to the main libreoffice draw interface. 
But he seems to have created the file (the enter press apparently trigger the button to start the export)

For it crashes: 
Version: 7.0.0.3 (x64)
Build ID: 8061b3e9204bef6b321a21033174034a5e2ea88e
CPU threads: 8; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: nl-BE (nl_BE); UI: en-US
Calc: CL

For this it works but it behaves erratic :
Version: 7.0.0.3 (x64)
Build ID: 8061b3e9204bef6b321a21033174034a5e2ea88e
CPU threads: 8; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: default; VCL: win
Locale: nl-BE (nl_BE); UI: en-US
Calc: CL
Comment 10 Luboš Luňák 2020-09-22 13:07:41 UTC
I've decided not to do anything about this in Skia, except for detecting such problems and aborting immediately. It's a problem of the dialog that it leads to requesting absurdly large images from Skia, so that's where this should be handled. If I try to handle this in Skia, that could lead to silently losing data.
Comment 11 Commit Notification 2020-09-23 06:47:18 UTC
Luboš Luňák committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/797315f220f82682748efaf80a29844a93f04f48

detect and fail immediately on failed Skia allocations (tdf#135952)

It will be available in 7.1.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 12 Commit Notification 2020-09-23 13:39:51 UTC
Luboš Luňák committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/7c0b0f6fa8ca294774401ddabb6773d707cb15b3

detect and fail immediately on failed Skia allocations (tdf#135952)

It will be available in 7.0.3.

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.