Bug 406463 - PostScript thumbnailer crashes with floating point exception
Summary: PostScript thumbnailer crashes with floating point exception
Status: RESOLVED FIXED
Alias: None
Product: kio-extras
Classification: Frameworks and Libraries
Component: Thumbnails and previews (show other bugs)
Version: 19.08.1
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: junior-jobs
: 414905 415190 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-04-12 10:25 UTC by Frank
Modified: 2019-12-29 08:46 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.12.1
Sentry Crash Report:


Attachments
File to reproduce the crash (32.38 KB, image/x-eps)
2019-12-16 12:20 UTC, Laurent Bonnaud
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank 2019-04-12 10:25:37 UTC
SUMMARY
kdeinit5 PID: 16374 Signal: Floating point exception (8) Datum: 12.04.19 12:14:13

STEPS TO REPRODUCE
dont't know. There is only Kmail, dolphin and Firefox open at that time it chrashes suddenly

OBSERVED RESULT
kdeinit5 chrashes

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Linux/ OPensuse tumbleweed
Kernel 5.06.-1 default

KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION


Application: kdeinit5 (kdeinit5), signal: Floating point exception
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f21382d1900 (LWP 16374))]


Thread 23 (Thread 0x7f20d77fe700 (LWP 16409)):
#0  0x00007f2139bd26c4 in read () from /lib64/libc.so.6
#1  0x00007f21387d3880 in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f213878c90f in g_main_context_check () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f213878cde0 in ?? () from /usr/lib64/libglib-2.0.so.0
#4  0x00007f213878cf5c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#5  0x00007f2139f79e7b in QEventDispatcherGlib::processEvents (this=0x7f20c4000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#6  0x00007f2139f253cb in QEventLoop::exec (this=this@entry=0x7f20d77fdc70, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140
#7  0x00007f2139d70016 in QThread::exec (this=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qflags.h:120
#8  0x00007f213601d565 in ?? () from /usr/lib64/libQt5DBus.so.5
#9  0x00007f2139d71362 in QThreadPrivate::start (arg=0x7f213609dd80) at thread/qthread_unix.cpp:361
#10 0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#11 0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 22 (Thread 0x7f20d7fff700 (LWP 16408)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 21 (Thread 0x7f20f4ff9700 (LWP 16407)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 20 (Thread 0x7f20f57fa700 (LWP 16406)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 19 (Thread 0x7f20f5ffb700 (LWP 16405)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 18 (Thread 0x7f20f67fc700 (LWP 16404)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 17 (Thread 0x7f20f6ffd700 (LWP 16403)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 16 (Thread 0x7f20f77fe700 (LWP 16402)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 15 (Thread 0x7f20f7fff700 (LWP 16401)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 14 (Thread 0x7f2118ff9700 (LWP 16400)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 13 (Thread 0x7f21197fa700 (LWP 16399)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 12 (Thread 0x7f2119ffb700 (LWP 16398)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 11 (Thread 0x7f211a7fc700 (LWP 16397)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 10 (Thread 0x7f211affd700 (LWP 16396)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 9 (Thread 0x7f211b7fe700 (LWP 16395)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 8 (Thread 0x7f211bfff700 (LWP 16394)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 7 (Thread 0x7f212898c700 (LWP 16393)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 6 (Thread 0x7f212918d700 (LWP 16392)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 5 (Thread 0x7f212998e700 (LWP 16391)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7f212a18f700 (LWP 16390)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7f212ab06700 (LWP 16389)):
#0  0x00007f213921403c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f212ee95e13 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#2  0x00007f212ee95b67 in ?? () from /usr/lib64/dri/radeonsi_dri.so
#3  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f2134dcc700 (LWP 16375)):
#0  0x00007f2139bd6ae9 in poll () from /lib64/libc.so.6
#1  0x00007f213a7fdcc7 in ?? () from /usr/lib64/libxcb.so.1
#2  0x00007f213a7ff8fa in xcb_wait_for_event () from /usr/lib64/libxcb.so.1
#3  0x00007f2134ffa788 in ?? () from /usr/lib64/libQt5XcbQpa.so.5
#4  0x00007f2139d71362 in QThreadPrivate::start (arg=0x5573305eedd0) at thread/qthread_unix.cpp:361
#5  0x00007f213920dfab in start_thread () from /lib64/libpthread.so.0
#6  0x00007f2139be16af in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f21382d1900 (LWP 16374)):
[KCrash Handler]
#6  0x00007f20f4755da2 in GSCreator::create (this=<optimized out>, path=..., width=128, height=128, img=...) at /usr/src/debug/kdegraphics-thumbnailers-18.12.3-1.1.x86_64/ps/gscreator.cpp:281
#7  0x00007f2135c1bdb1 in ThumbnailProtocol::createSubThumbnail (this=this@entry=0x7ffc5028c320, thumbnail=..., filePath=..., segmentWidth=segmentWidth@entry=12, segmentHeight=segmentHeight@entry=7) at /usr/src/debug/kio-extras5-18.12.3-1.1.x86_64/thumbnail/thumbnail.cpp:723
#8  0x00007f2135c1c388 in ThumbnailProtocol::drawSubThumbnail (this=this@entry=0x7ffc5028c320, p=..., filePath=..., width=width@entry=12, height=height@entry=7, xPos=xPos@entry=2, yPos=17, frameWidth=0) at /usr/src/debug/kio-extras5-18.12.3-1.1.x86_64/thumbnail/thumbnail.cpp:755
#9  0x00007f2135c1c9d0 in ThumbnailProtocol::thumbForDirectory (this=this@entry=0x7ffc5028c320, directory=...) at /usr/src/debug/kio-extras5-18.12.3-1.1.x86_64/thumbnail/thumbnail.cpp:558
#10 0x00007f2135c1e117 in ThumbnailProtocol::get (this=0x7ffc5028c320, url=...) at /usr/src/debug/kio-extras5-18.12.3-1.1.x86_64/thumbnail/thumbnail.cpp:238
#11 0x00007f21364ade36 in KIO::SlaveBase::dispatch (this=0x7ffc5028c320, command=67, data=...) at /usr/src/debug/kio-5.56.0-1.1.x86_64/src/core/slavebase.cpp:1126
#12 0x00007f21364ae4f6 in KIO::SlaveBase::dispatchLoop (this=this@entry=0x7ffc5028c320) at /usr/src/debug/kio-5.56.0-1.1.x86_64/src/core/slavebase.cpp:325
#13 0x00007f2135c1b0bc in kdemain (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kio-extras5-18.12.3-1.1.x86_64/thumbnail/thumbnail.cpp:138
#14 0x000055732e7a5bf7 in launch (argc=4, _name=0x5573305c84f8 "/usr/lib64/qt5/plugins/kf5/kio/thumbnail.so", args=<optimized out>, cwd=<optimized out>, envc=0, envs=<optimized out>, reset_env=false, tty=0x0, avoid_loops=false, startup_id_str=0x55732e7a9173 "0") at /usr/src/debug/kinit-5.56.0-1.1.x86_64/src/kdeinit/kinit.cpp:706
#15 0x000055732e7a6c2a in handle_launcher_request (sock=8, who=<optimized out>) at /usr/src/debug/kinit-5.56.0-1.1.x86_64/src/kdeinit/kinit.cpp:1146
#16 0x000055732e7a7548 in handle_requests (waitForPid=0) at /usr/src/debug/kinit-5.56.0-1.1.x86_64/src/kdeinit/kinit.cpp:1339
#17 0x000055732e7a25b5 in main (argc=5, argv=<optimized out>) at /usr/src/debug/kinit-5.56.0-1.1.x86_64/src/kdeinit/kinit.cpp:1785
[Inferior 1 (process 16374) detached]
Comment 1 Christoph Feck 2019-04-12 12:13:39 UTC
Could you find the Postscript or PDF file which causes GhostScript to crash?
Comment 2 Frank 2019-04-12 15:33:57 UTC
(In reply to Christoph Feck from comment #1)
> Could you find the Postscript or PDF file which causes GhostScript to crash?

I'm not sure. I may have opened an e-mail attachment when it happened. 
i can't trace the trigger at the moment
Comment 3 Christoph Feck 2019-12-16 08:40:28 UTC
*** Bug 415190 has been marked as a duplicate of this bug. ***
Comment 4 Christoph Feck 2019-12-16 08:43:24 UTC
It is a division by zero. With certain sizes, the "scale" variable can be zero, and I suggest to modify the code to use floats.

https://cgit.kde.org/kdegraphics-thumbnailers.git/tree/ps/gscreator.cpp#n276
Comment 5 Christoph Feck 2019-12-16 08:50:36 UTC
*** Bug 414905 has been marked as a duplicate of this bug. ***
Comment 6 Laurent Bonnaud 2019-12-16 12:20:55 UTC
Created attachment 124525 [details]
File to reproduce the crash
Comment 7 Elvis Angelaccio 2019-12-28 18:59:55 UTC
Git commit af3f38a4d8f6ab66a463dd13e78385f34f4af933 by Elvis Angelaccio.
Committed on 28/12/2019 at 18:58.
Pushed by elvisangelaccio into branch 'release/19.12'.

Prevent division by zero and force ghostscript run

The `scale` variable can be zero since it's an int. This code should
probably be refactored to use floats, but since no one touched it in
years, this is a quick workaround to not make it crash and to get a
working thumbnail by forcing a ghostscript run with the `break;`.
FIXED-IN: 19.12.1

M  +1    -0    ps/gscreator.cpp

https://commits.kde.org/kdegraphics-thumbnailers/af3f38a4d8f6ab66a463dd13e78385f34f4af933
Comment 8 Elvis Angelaccio 2019-12-28 19:04:28 UTC
(In reply to Christoph Feck from comment #4)
> It is a division by zero. With certain sizes, the "scale" variable can be
> zero, and I suggest to modify the code to use floats.
> 
> https://cgit.kde.org/kdegraphics-thumbnailers.git/tree/ps/gscreator.cpp#n276

I took the liberty to push a different fix. I tried to use floats and while it stopped crashing, it still wouldn't get a thumbnail out of the attached file. I then looked at the rest of the code and I gave up. Not easy at all to refactor it with floats.
Comment 9 Laurent Bonnaud 2019-12-29 08:46:50 UTC
Thanks a lot for the fix!