Bug 434273 - Crash when importing an invalid .icc or .icm file
Summary: Crash when importing an invalid .icc or .icm file
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Debian stable Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-11 08:55 UTC by Ahab Greybeard
Modified: 2021-03-11 09:07 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
A 'fake' .icc file to crash krita (5.16 KB, application/vnd.iccprofile)
2021-03-11 08:55 UTC, Ahab Greybeard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahab Greybeard 2021-03-11 08:55:35 UTC
Created attachment 136579 [details]
A 'fake' .icc file to crash krita

SUMMARY
This happens with appimages from 4.3.0 to the Mar10 4.4.4 alpha (git c7f093c) and the Mar10 5.0.0 prealpha (git 2bd49f3).

An invalid .icc file, 'kritacrash.icc', is attached, which is actually a text file.
The same behaviour is observed if you deliberately corrupt a genuine .icc or .icm file with random text insertions.

Despite the crash, the invalid file is imported. 
On restart it is detected as invalid and is not included in colour profile lists.
A further attempt to import it has no effect.

I suspect that this crash is not likely to be encountered often.

STEPS TO REPRODUCE
1. via Image -> Convert Image Colour Space -> Colour Browser, import the kritacrash.icc file.
2. Restart after the crash.
3. Repeat Step 1.

OBSERVED RESULT
1. Crash with terminal output at the end:

kf5.kwidgetsaddons: Invalid pixmap specified.
[Note: The output line above happens as soon as the colour browser is opened.]
Lcms2 error:  11 not an ICC profile, invalid signature
Lcms2 error:  11 not an ICC profile, invalid signature
Failed to load profile from  "/home/adminahab/.local/share/krita/profiles/kritacrash.icc"
Lcms2 error:  11 not an ICC profile, invalid signature
Segmentation fault

The kritacrash.icc file is in the krita resources 'profiles' subfolder.

2. Terminal output at the start:

Lcms2 error:  11 not an ICC profile, invalid signature
Lcms2 error:  11 not an ICC profile, invalid signature
Failed to load profile from  "/home/adminahab/.local/share/krita/profiles/kritacrash.icc"
Invalid profile :  "/home/adminahab/.local/share/krita/profiles/kritacrash.icc" ""

3. No visible effect.

Terminal output at the end:

kf5.kwidgetsaddons: Invalid pixmap specified.
[Note: The above output happens as soon as the colour browser is opened.]


EXPECTED RESULT
1. No crash: The invalid file should be detected as invalid and not imported.
A warning/advisory message should be displayed.

SOFTWARE/OS VERSIONS
Krita

 Version: 4.4.4-alpha (git c7f093c)
 Languages: en_GB, en, en, en_GB, en
 Hidpi: false

Qt

  Version (compiled): 5.12.9
  Version (loaded): 5.12.9

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.19.0-14-amd64
  Pretty Productname: Debian GNU/Linux 10 (buster)
  Product Type: debian
  Product Version: 10
  Desktop: MATE

OpenGL Info
 
  Vendor:  "NVIDIA Corporation" 
  Renderer:  "GeForce GTX 750 Ti/PCIe/SSE2" 
  Version:  "4.6.0 NVIDIA 460.39" 
  Shading language:  "4.60 NVIDIA" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:    QSurfaceFormat(version 4.6, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
     Version: 4.6
     Supports deprecated functions true 
     is OpenGL ES: false 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsOpenGLES: true 
  isQtPreferOpenGLES: false
Comment 1 Halla Rempt 2021-03-11 09:07:17 UTC
Git commit 7d9f366a2316fec7ee5d6896484408c49d9743e1 by Halla Rempt.
Committed on 11/03/2021 at 09:07.
Pushed by rempt into branch 'master'.

Fix crash on importing a broken icc profile

M  +3    -1    plugins/color/lcms2engine/IccColorSpaceEngine.cpp

https://invent.kde.org/graphics/krita/commit/7d9f366a2316fec7ee5d6896484408c49d9743e1
Comment 2 Halla Rempt 2021-03-11 09:07:36 UTC
Git commit 2b2a66cbcbfd00d628ad6e1190772f48b4072d5a by Halla Rempt.
Committed on 11/03/2021 at 09:07.
Pushed by rempt into branch 'krita/4.3'.

Fix crash on importing a broken icc profile
(cherry picked from commit 7d9f366a2316fec7ee5d6896484408c49d9743e1)

M  +3    -1    plugins/color/lcms2engine/IccColorSpaceEngine.cpp

https://invent.kde.org/graphics/krita/commit/2b2a66cbcbfd00d628ad6e1190772f48b4072d5a