Bug 442205

Summary: A .kra file with an enormous vector selection will seem to hang on loading
Product: [Applications] krita Reporter: rebuilderster
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR    
Version First Reported In: 5.0.0-beta1   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Example .KRA file created following the steps described, will cause Krita to hang when opened.

Description rebuilderster 2021-09-09 07:12:15 UTC
SUMMARY
if a selection is active when saving to .kra, the resulting .kra file can not be opened, but Krita will hang with 1 cpu thread at 100%.

I've provided the precise steps to reproduce, I'm not sure if all are needed.

STEPS TO REPRODUCE
1. Create a new file, at 4000x3000 pixels
2. create a new layer, draw something on it.
3. create a rectangular selection that partially goes outside the canvas bounds (don't know if this is important, but it's what I did)
4. save the file as .kra and close it.
5. reopen the file.

OBSERVED RESULT
Krita hangs.
Comment 1 rebuilderster 2021-09-09 08:26:42 UTC
Created attachment 141415 [details]
Example .KRA file created following the steps described, will cause Krita to hang when opened.
Comment 2 Halla Rempt 2021-09-09 08:34:32 UTC
With your file, I can reproduce the hang, but I cannot create such a file myself. Are you using the appimage, or distribution packages?
Comment 3 Halla Rempt 2021-09-09 08:57:10 UTC
For some reason, the selection mask is enormous:

<svg xmlns="http://www.w3.org/2000/svg" 
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:krita="http://krita.org/namespaces/svg/krita"
    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    width="288000pt"
    height="216000pt"
    viewBox="0 0 288000 216000">
<defs/>
<rect id="shape0" transform="translate(145152, 47520)" fill="none" width="145584" height="95472"/>
</svg>
Comment 4 Halla Rempt 2021-09-09 09:04:03 UTC
Krita doesn't actually hang, it just tries to render that vector shape. Given that the resolution of this image is 1dpi, that will not go well.
Comment 5 Halla Rempt 2022-08-11 10:49:57 UTC
I'm not sure what we changed in the meantime... But the file now loads instantly!