Bug 471958

Summary: Gwenview crash at startup/didn't start and crahs with "free(): invalid pointer"
Product: [Frameworks and Libraries] frameworks-kimageformats Reporter: Joerg Schiermeier <kde-bug>
Component: generalAssignee: Alex Merry <alex.merry>
Status: CLOSED DOWNSTREAM    
Severity: crash CC: aacid, hardpenguin13, hlehmbruch, jedi.master, kdelibs-bugs, mircomir, nicolas.fella
Priority: NOR Keywords: drkonqi
Version: 5.107.0   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Example jpg file that crashes Gwenview
one of the images which crashing gwenview

Description Joerg Schiermeier 2023-07-04 20:29:46 UTC
Application: gwenview (23.04.2)

Qt Version: 5.15.8
Frameworks Version: 5.107.0
Operating System: Linux 6.3.0-2-amd64 x86_64
Windowing System: X11
Distribution: Devuan GNU/Linux 6 (excalibur/ceres)
DrKonqi: 5.27.5 [KCrashBackend]

-- Information about the crash:
So I tried to start it via Konsole and got this:

user@Machine ~/Downloads % gwenview
free(): invalid pointer
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = gwenview path = /usr/bin pid = 12884
KCrash: Arguments: /usr/bin/gwenview 
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi
zsh: suspended (signal)  gwenview
user@Machine ~/Downloads %

The crash can be reproduced every time.

-- Backtrace:
Application: Gwenview (gwenview), signal: Aborted

[KCrash Handler]
#4  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#5  0x00007fbcb02a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#6  0x00007fbcb025a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#7  0x00007fbcb02444b2 in __GI_abort () at ./stdlib/abort.c:79
#8  0x00007fbcb02451ed in __libc_message (fmt=fmt@entry=0x7fbcb03b778c "%s\n") at ../sysdeps/posix/libc_fatal.c:150
#9  0x00007fbcb02b1a75 in malloc_printerr (str=str@entry=0x7fbcb03b522c "free(): invalid pointer") at ./malloc/malloc.c:5651
#10 0x00007fbcb02b37f4 in _int_free (av=<optimized out>, p=<optimized out>, have_lock=have_lock@entry=0) at ./malloc/malloc.c:4425
#11 0x00007fbcb02b616f in __GI___libc_free (mem=<optimized out>) at ./malloc/malloc.c:3367
#12 0x00007fbcae2d9792 in LibRaw::~LibRaw() () from /lib/x86_64-linux-gnu/libraw.so.23
#13 0x00007fbcae2d97e9 in LibRaw::~LibRaw() () from /lib/x86_64-linux-gnu/libraw.so.23
#14 0x00007fbca07b96ea in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/kimg_raw.so
#15 0x00007fbca07b990c in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/kimg_raw.so
#16 0x00007fbcb0fa9f94 in ?? () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#17 0x00007fbcb0faaf86 in ?? () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#18 0x00007fbcb0faba6c in QImageReader::canRead() const () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#19 0x00007fbcb2511cd2 in ?? () from /lib/x86_64-linux-gnu/libKF5IconThemes.so.5
#20 0x00007fbcb2512bc7 in KIconLoader::loadScaledIcon(QString const&, KIconLoader::Group, double, QSize const&, int, QStringList const&, QString*, bool, std::optional<KIconColors> const&) const () from /lib/x86_64-linux-gnu/libKF5IconThemes.so.5
#21 0x00007fbcb2508253 in KIconEngine::createPixmap(QSize const&, double, QIcon::Mode, QIcon::State) () from /lib/x86_64-linux-gnu/libKF5IconThemes.so.5
#22 0x00007fbcb2508675 in KIconEngine::pixmap(QSize const&, QIcon::Mode, QIcon::State) () from /lib/x86_64-linux-gnu/libKF5IconThemes.so.5
#23 0x00007fbcb0fccbc4 in QIcon::pixmap(QWindow*, QSize const&, QIcon::Mode, QIcon::State) const () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#24 0x00007fbcb0fcccce in QIcon::pixmap(QSize const&, QIcon::Mode, QIcon::State) const () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#25 0x0000560cab208b8d in ?? ()
#26 0x0000560cab20770d in ?? ()
#27 0x0000560cab1ff43b in ?? ()
#28 0x0000560cab1fda56 in ?? ()
#29 0x0000560cab1f450e in ?? ()
#30 0x0000560cab1c757d in ?? ()
#31 0x00007fbcb02456ca in __libc_start_call_main (main=main@entry=0x560cab1c7070, argc=argc@entry=1, argv=argv@entry=0x7fffa472eea8) at ../sysdeps/nptl/libc_start_call_main.h:58
#32 0x00007fbcb0245785 in __libc_start_main_impl (main=0x560cab1c7070, argc=1, argv=0x7fffa472eea8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffa472ee98) at ../csu/libc-start.c:360
#33 0x0000560cab1c76c1 in ?? ()
[Inferior 1 (process 12392) detached]

Reported using DrKonqi
Comment 1 Nicolas Fella 2023-07-05 12:54:24 UTC
*** Bug 471973 has been marked as a duplicate of this bug. ***
Comment 2 Albert Astals Cid 2023-07-05 14:03:46 UTC
How many files do you have in the directory that gwenview is trying to open?

Are they shareable?
Comment 3 hardpenguin13 2023-07-05 14:11:52 UTC
(In reply to Albert Astals Cid from comment #2)
> How many files do you have in the directory that gwenview is trying to open?
> 
> Are they shareable?

In my case (reported in 471973 and marked as duplicate) it doesn't matter what kind of image file and what amount of files in a directory. PNG, JPG, GIF, XFC, BMP, all tested by me to crash all the same in a variety of folder configurations. I don't think that providing an example file will move us any closer to resolving it in this case.
Comment 4 Joerg Schiermeier 2023-07-05 14:21:50 UTC
(In reply to Albert Astals Cid from comment #2)
> How many files do you have in the directory that gwenview is trying to open?

one picture
See this:

---------- Begin: Konsole output (zsh) ----------
user@machine ~/Medien/Bilder/_Screenshots % ls -l
insgesamt 152
-rw-r--r-- 1 joerg joerg 154148  5. Jul 16:12 Bildschirmfoto_2023-07-05_16-12-27.png
joerg@Archimedes ~/Medien/Bilder/_Screenshots % gwenview
free(): invalid pointer
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = gwenview path = /usr/bin pid = 31856
KCrash: Arguments: /usr/bin/gwenview 
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi
user@machine ~/Medien/Bilder/_Screenshots %
---------- End: Konsole output (zsh) ----------

Second try:
---------- Begin: Konsole output (zsh) ----------
user@machine ~/Medien/Bilder/_Screenshots % gwenview Bildschirmfoto_2023-07-05_16-12-27.png
free(): invalid pointer
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = gwenview path = /usr/bin pid = 31969
KCrash: Arguments: /usr/bin/gwenview Bildschirmfoto_2023-07-05_16-12-27.png 
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi
zsh: suspended (signal)  gwenview Bildschirmfoto_2023-07-05_16-12-27.png
user@machine ~/Medien/Bilder/_Screenshots %
---------- End: Konsole output (zsh) ----------

> Are they shareable?
yes.
Comment 5 hardpenguin13 2023-07-05 15:29:41 UTC
If this is of any help, these are Debian packages that I have installed in between Gwenview working and not working.

Install: linux-image-6.3.0-2-amd64:amd64 (6.3.11-1, automatic), linux-headers-6.3.0-2-amd64:amd64 (6.3.11-1, automatic), libconfig++9v5:amd64 (1.5-0.4, automatic), libxml++2.6-2v5:amd64 (2.40.1-3, automatic), libraw23:amd64 (0.21.1-4, automatic), linux-headers-6.3.0-2-common:amd64 (6.3.11-1, automatic), libffado2:amd64 (2.4.7-1, automatic)
Upgrade: kodi-data:amd64 (2:20.1+dfsg-1, 2:20.2+dfsg-1), libsigc++-3.0-0:amd64 (3.4.0-6, 3.4.0-7), libraptor2-0:amd64 (2.0.15-4, 2.0.16-2), tzdata:amd64 (2023c-6, 2023c-7), libkf5kdcraw5:amd64 (22.12.3-1, 22.12.3-1+b1), libpipewire-0.3-common:amd64 (0.3.71-2, 0.3.72-2), pipewire-pulse:amd64 (0.3.71-2+b2, 0.3.72-2), kodi:amd64 (2:20.1+dfsg-1, 2:20.2+dfsg-1), libcairomm-1.16-1:amd64 (1.16.2-4, 1.16.2-6), linux-headers-amd64:amd64 (6.3.7-1, 6.3.11-1), pipewire:amd64 (0.3.71-2+b2, 0.3.72-2), linux-image-amd64:amd64 (6.3.7-1, 6.3.11-1), libspa-0.2-bluetooth:amd64 (0.3.71-2+b2, 0.3.72-2), python3-cairo:amd64 (1.20.1-5+b1, 1.24.0-1), pipewire-bin:amd64 (0.3.71-2+b2, 0.3.72-2), kodi-bin:amd64 (2:20.1+dfsg-1, 2:20.2+dfsg-1), libspa-0.2-modules:amd64 (0.3.71-2+b2, 0.3.72-2), kodi-repository-kodi:amd64 (2:20.1+dfsg-1, 2:20.2+dfsg-1), libpipewire-0.3-modules:amd64 (0.3.71-2+b2, 0.3.72-2), wireplumber:amd64 (0.4.14-2, 0.4.14-3), libwireplumber-0.4-0:amd64 (0.4.14-2, 0.4.14-3), libpipewire-0.3-0:amd64 (0.3.71-2+b2, 0.3.72-2)

From Gwenview dependencies, only libkf5kdcraw5 is there. 

And since "Libkdcraw is a Qt interface to the libraw library used to decode RAW picture files. " and libraw pops up in both Joerg's and mine error logs, I would say that this might be it.
Comment 6 hardpenguin13 2023-07-05 15:30:37 UTC
Oh and libraw itself is there as well.
Comment 7 Albert Astals Cid 2023-07-05 15:31:06 UTC
Then  please attach the image that makes it crash for you.
Comment 8 Hendrik Lehmbruch 2023-07-05 15:43:00 UTC
Gwenview crashing also on debian unstable

gwenview 23.04.2

KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.8
Graphics Platform: Wayland

------------- konsole (bash)-------------------------
hhl@localhost:~/Bilder$ LANG=C gwenview latest.png 
kf.i18n.kuit: "Unknown subcue ':whatsthis,' in UI marker in context {@info:whatsthis, %1 the action's text}."
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-aptus-mos"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-arq"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-bay"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-bmq"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-cap"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-cine"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-cs1"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-dc2"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-drf"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-dxo"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-epson-eip"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-epson-erf"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-fff"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-hasselblad-3fr"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-iiq"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-kodak-dcs"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-kodak-kc2"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-mamiya-mef"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-mfw"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-minolta-mdc"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-mng"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-obm"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-ori"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-ptx"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-pxn"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-qtk"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-r3d"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-raw"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-rdc"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-rwl"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-rwz"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-samsung-srw"
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-sti"
org.kde.kdegraphics.gwenview.lib: Unresolved raw mime type  "image/x-samsung-srw"
free(): invalid pointer
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = gwenview path = /usr/bin pid = 840304
KCrash: Arguments: /usr/bin/gwenview latest.png 
The Wayland connection experienced a fatal error: Bad file descriptor
----------------------------------------------------------------------

-----------------------------------------------------------------------
hhl@localhost:~/Bilder$ LANG=C ls -l
total 548
-rw-rw---- 1 hhl hhl  90429 28. Apr  07:38 1682660173462.jpg
-rw-r--r-- 1 hhl hhl  95590 15. Jun  12:18 Screenshot_20230615_121816.png
-rw-r--r-- 1 hhl hhl 191088 29. Mai  11:59 latest.png
-rw-r--r-- 1 hhl hhl  16406 26. Jun  15:48 mow-breeze-screenshot.png
-rw-r--r-- 1 hhl hhl 147658 16. Apr  23:33 shortc.png
drwxr-xr-x 2 hhl hhl   4096 28. Mai  17:13 smplayer_screenshots
-----------------------------------------------------------------------------

to answer the question, 5 pictures and yes
Comment 9 hardpenguin13 2023-07-05 15:56:57 UTC
Created attachment 160090 [details]
Example jpg file that crashes Gwenview
Comment 10 Hendrik Lehmbruch 2023-07-05 16:07:08 UTC
Created attachment 160091 [details]
one of the images which crashing gwenview

one of the images which makes gwenview crashing, and it is equal if trying to open a png or jpg file, gwenview crashes.

And as written above, libkf5kdcraw5 and libraw23 came in with a full-upgrade!
Comment 11 Albert Astals Cid 2023-07-05 16:24:19 UTC
works fine for me, the way you're describing this issue it could very well be that debian messed up the transition of libraw and forgot to rebuild kimageformats, have you reported this to them?
Comment 12 Hendrik Lehmbruch 2023-07-05 16:28:08 UTC
good catch, https://release.debian.org/transitions/html/auto-libraw.html
Comment 13 Nicolas Fella 2023-07-05 17:33:18 UTC
*** Bug 471980 has been marked as a duplicate of this bug. ***
Comment 14 Mirco Miranda 2023-07-05 18:11:54 UTC
I have the same issue on my Debian unstable after today dist-upgrade. The problem is that the transition to libraw23 is not complete and some libraries are compiled using libraw20 and some others with libraw23. 
Gwenview uses kimage-plugins (that are still compiled with libraw20) and libkf5kdcraw (that uses libraw23). This is the why of the crash.
The kimgraw plugin of kimage-plugins supports latest libraw version... we have to wait that the mantainers releases the package compiled using latest libraw.
Comment 15 Hendrik Lehmbruch 2023-07-05 19:06:10 UTC
I think this issue can be closed. Because the upload of kimageformat-plugins (5.107.0-2) in debian unstable fixes that little problem.
Comment 16 hardpenguin13 2023-07-06 08:50:21 UTC
Indeed, the issue is gone now and my Gwenview is back to normal.

Thank you everyone!
Comment 17 Joerg Schiermeier 2023-07-06 12:00:07 UTC
Following the reports here: this bug is fixed.