https://bugs.kde.org/show_bug.cgi?id=522949

            Bug ID: 522949
           Summary: Crash when it tries to open a .webp file named .png
                    (same for .png named .jpg)
    Classification: Applications
           Product: gwenview
      Version First 26.04.0
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 194220
  --> https://bugs.kde.org/attachment.cgi?id=194220&action=edit
valgrind analysis

DESCRIPTION
Gwenview crashes when it tries to open a .webp file named .png.
The same thing happens if, when opening the folder, the folder contains only
that image.
The same thing happens when the file is a PNG with the .jpg extension.

See backtrace & valgrind analysis.

STEPS TO REPRODUCE
1. Put the image in a folder
2. Run `gwenview test.png` or `gwenview .` 

OBSERVED RESULT
Instant crash.

EXPECTED RESULT
Should not depend on the extension as a source of truth.

SOFTWARE/OS VERSIONS
Operating System: Kali GNU/Linux 2026.2
KDE Plasma Version: 6.6.5
KDE Frameworks Version: 6.23.0
Qt Version: 6.10.2
Graphics Platform: X11

ADDITIONAL INFORMATION

gdb backtrace:
```
(gdb) bt
#0  0x00007ffff1b7f927 in libraw_memmgr::cleanup (this=0x7fffd00c2cc8) at
./libraw/libraw_alloc.h:75
#1  LibRaw::recycle (this=this@entry=0x7fffd00073e0) at
src/utils/init_close_utils.cpp:326
#2  0x00007ffff1b7faf0 in LibRaw::open_datastream (this=0x7fffd00073e0,
stream=0x7fffd71fe150) at src/utils/open.cpp:479
#3  0x00007fffdf67137c in ??? () at
/usr/lib/x86_64-linux-gnu/qt6/plugins/imageformats/kimg_raw.so
#4  0x00007fffdf6716ff in ??? () at
/usr/lib/x86_64-linux-gnu/qt6/plugins/imageformats/kimg_raw.so
#5  0x00007ffff5bba612 in createReadHandlerHelper (device=<optimized out>,
format=..., autoDetectImageFormat=<optimized out>,
ignoresFormatAndExtension=<optimized out>)
    at ./src/gui/image/qimagereader.cpp:302
#6  0x00007ffff5bbb09d in QImageReaderPrivate::initHandler
(this=0x7fffd0001b50) at ./src/gui/image/qimagereader.cpp:525
#7  0x00007ffff5bbb620 in QImageReader::canRead
(this=this@entry=0x7fffd71fe550) at ./src/gui/image/qimagereader.cpp:1088
#8  0x00007ffff7cb9ecb in Gwenview::LoadingDocumentImplPrivate::loadMetaInfo
(this=0x5555565812c0) at ./lib/document/loadingdocumentimpl.cpp:247
#9  0x00007ffff7cb80af in std::__invoke_impl<bool, bool
(Gwenview::LoadingDocumentImplPrivate::*&)(),
Gwenview::LoadingDocumentImplPrivate*&>
    (__f=<synthetic pointer>: <optimized out>, __t=<synthetic pointer>:
<optimized out>) at /usr/include/c++/15/bits/invoke.h:73
#10 std::__invoke<bool (Gwenview::LoadingDocumentImplPrivate::*&)(),
Gwenview::LoadingDocumentImplPrivate*&> (__fn=<synthetic pointer>: <optimized
out>)
    at /usr/include/c++/15/bits/invoke.h:98
#11 std::invoke<bool (Gwenview::LoadingDocumentImplPrivate::*&)(),
Gwenview::LoadingDocumentImplPrivate*&> (__fn=<synthetic pointer>: <optimized
out>)
    at /usr/include/c++/15/functional:122
#12 QtConcurrent::StoredFunctionCall<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>::runFunctor()::{lambda(bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*)#1}::operator()(bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*) const
    (__closure=<optimized out>, function=<optimized out>, args#0=<optimized
out>) at
/usr/include/x86_64-linux-gnu/qt6/QtConcurrent/qtconcurrentstoredfunctioncall.h:117
#13 std::__invoke_impl<bool, QtConcurrent::StoredFunctionCall<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>::runFunctor()::{lambda(bool
(Gwenview::LoadingDocumentImplPrivate::* const&)(),
Gwenview::LoadingDocumentImplPrivate*)#1}, bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>(std::__invoke_other,
QtConcurrent::StoredFunctionCall<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>::runFunctor()::{lambda(bool
(Gwenview::LoadingDocumentImplPrivate::* const&)(),
Gwenview::LoadingDocumentImplPrivate*)#1}, bool
(Gwenview::LoadingDocumentImplPrivate::*&&)(),
Gwenview::LoadingDocumentImplPrivate*&&)
    (__f=<optimized out>) at /usr/include/c++/15/bits/invoke.h:63
#14 std::__invoke<QtConcurrent::StoredFunctionCall<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>::runFunctor()::{lambda(bool
(Gwenview::LoadingDocumentImplPrivate::* const&)(),
Gwenview::LoadingDocumentImplPrivate*)#1}, bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>(QtConcurrent::StoredFunctionCall<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>::runFunctor()::{lambda(bool
(Gwenview::LoadingDocumentImplPrivate::* const&)(),
Gwenview::LoadingDocumentImplPrivate*)#1}, bool
(Gwenview::LoadingDocumentImplPrivate::*&&)(),
Gwenview::LoadingDocumentImplPrivate*&&) (__fn=<synthetic pointer>...)
    at /usr/include/c++/15/bits/invoke.h:98
#15 std::__apply_impl<QtConcurrent::StoredFunctionCall<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>::runFunctor()::{lambda(bool
(Gwenview::LoadingDocumentImplPrivate::* const&)(),
Gwenview::LoadingDocumentImplPrivate*)#1}, std::tuple<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>, 0ul,
1ul>(QtConcurrent::StoredFunctionCall<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>::runFunctor()::{lambda(bool
(Gwenview::LoadingDocumentImplPrivate::* const&)(),
Gwenview::LoadingDocumentImplPrivate*)#1}, std::tuple<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>&&, std::integer_sequence<unsigned long,
0ul, 1ul>) (__f=<synthetic pointer>..., __t=...) at
/usr/include/c++/15/tuple:2920
#16 std::apply<QtConcurrent::StoredFunctionCall<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>::runFunctor()::{lambda(bool
(Gwenview::LoadingDocumentImplPrivate::* const&)(),
Gwenview::LoadingDocumentImplPrivate*)#1}, std::tuple<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*> >(QtConcurrent::StoredFunctionCall<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>::runFunctor()::{lambda(bool
(Gwenview::LoadingDocumentImplPrivate::* const&)(),
Gwenview::LoadingDocumentImplPrivate*)#1}, std::tuple<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>&&)
    (__f=<synthetic pointer>..., __t=...) at /usr/include/c++/15/tuple:2935
--Type <RET> for more, q to quit, c to continue without paging--
#17 QtConcurrent::StoredFunctionCall<bool
(Gwenview::LoadingDocumentImplPrivate::*)(),
Gwenview::LoadingDocumentImplPrivate*>::runFunctor (this=0x5555565b1430)
    at
/usr/include/x86_64-linux-gnu/qt6/QtConcurrent/qtconcurrentstoredfunctioncall.h:123
#18 0x00007ffff7cbb0f7 in QtConcurrent::RunFunctionTaskBase<bool>::run
(this=0x5555565b1430) at
/usr/include/x86_64-linux-gnu/qt6/QtConcurrent/qtconcurrentrunbase.h:84
#19 0x00007ffff54992a5 in QThreadPoolThread::run (this=0x5555560cc960) at
./src/corelib/thread/qthreadpool.cpp:72
#20 0x00007ffff552df1b in operator() (__closure=<optimized out>) at
./src/corelib/thread/qthread_unix.cpp:448
#21 (anonymous
namespace)::terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> >
(t=<optimized out>) at ./src/corelib/thread/qthread_unix.cpp:373
#22 QThreadPrivate::start (arg=0x5555560cc960) at
./src/corelib/thread/qthread_unix.cpp:422
#23 0x00007ffff4c9dda9 in start_thread (arg=<optimized out>) at
./nptl/pthread_create.c:448
#24 0x00007ffff4d1ce08 in __GI___clone3 () at
../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
```

valgrind analysis: `valgrind --log-file=../mylog gwenview test.png`, see
attachment.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to