gmic_gimp_qt: fatal error: Segmentation fault

Here’s what happened…

$ ./gmic_qt image.jpg 

(gmic_qt:362598): Gtk-WARNING **: 12:55:08.025: Theme parsing error: gtk.css:4:1: '/*' in comment block
AddressSanitizer:DEADLYSIGNAL
=================================================================
==362598==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f382429ea88 bp 0x7fff539549f0 sp 0x7fff53954170 T0)
==362598==The signal is caused by a READ memory access.
==362598==Hint: address points to the zero page.
    #0 0x7f382429ea88 in __interceptor_strcmp /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:442
    #1 0x564f6353dd79 in gmic& gmic::_run<float>(cimg_library::CImgList<char> const&, unsigned int&, cimg_library::CImgList<float>&, cimg_library::CImgList<char>&, cimg_library::CImgList<float>&, cimg_library::CImgList<char>&, unsigned int const*, bool*, char const*, cimg_library::CImg<unsigned int> const*) ../src/gmic.cpp:15010
    #2 0x564f6342fb65 in gmic& gmic::_run<float>(cimg_library::CImgList<char> const&, cimg_library::CImgList<float>&, cimg_library::CImgList<char>&, float*, bool*) ../src/gmic.cpp:4973
    #3 0x564f634188b3 in void gmic::_gmic<float>(char const*, cimg_library::CImgList<float>&, cimg_library::CImgList<char>&, char const*, bool, float*, bool*) ../src/gmic.cpp:4077
    #4 0x564f6340e93c in gmic::gmic<float>(char const*, cimg_library::CImgList<float>&, cimg_library::CImgList<char>&, char const*, bool, float*, bool*) ../src/gmic.cpp:3973
    #5 0x564f6336005b in Updater::updateSources(bool) src/Updater.cpp:69
    #6 0x564f633607f0 in Updater::startUpdate(int, int, bool) src/Updater.cpp:102
    #7 0x564f6333de42 in MainWindow::showEvent(QShowEvent*) src/MainWindow.cpp:1113
    #8 0x7f382389eb0d in QWidget::event(QEvent*) (/usr/lib/libQt5Widgets.so.5+0x19bb0d)
    #9 0x7f382385d751 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/libQt5Widgets.so.5+0x15a751)
    #10 0x7f3822c13a79 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/usr/lib/libQt5Core.so.5+0x2b5a79)
    #11 0x7f382389b337 in QWidgetPrivate::show_helper() (/usr/lib/libQt5Widgets.so.5+0x198337)
    #12 0x7f382389e64c in QWidgetPrivate::setVisible(bool) (/usr/lib/libQt5Widgets.so.5+0x19b64c)
    #13 0x564f632cded8 in launchPlugin() src/gmic_qt.cpp:130
    #14 0x564f6316a415 in main src/Host/None/host_none.cpp:232
    #15 0x7f3822395151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #16 0x564f63166dcd in _start (/home/akovia/build/gmic_2.9.3/gmic-2.9.3/gmic-qt/gmic_qt+0x231dcd)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:442 in __interceptor_strcmp
==362598==ABORTING
1 Like

That’s interesting, thanks. Will check.

Update : I’ve currently compiled G’MIC with the address sanitizer and I get indeed a few issues.
I’ll try to fix those ASAP and make you know when it’s ready.
This will probably lead to a 2.9.4 release…

Thanks for your report!

1 Like

I’ve made two fixes related to possible wron memory access.
Would you like to test on your machine ?
Basically, you have to modify file gmic.cpp, with the following commits:

and

That’s minor modifications that you can apply on the sources, then you have to recompile everything, and test once again.
Thanks for your help !

I’d love to try it but I’m not finding gmic.cpp in my sources.

I went to the gmic-master source tree in the git links you sent and modified the code as suggested, but then the commands you gave to build it do not work.

Sorry but it seems I need some hand-holding, as I don’t understand how to build it.

I’ll prepare an up-to-date pre-release archive and post it in a few minutes (half an hour).
It will be easier to make the test. I’ll let you know when it’s ready!

Thank you!

Here is the link : https://gmic.eu/files/prerelease/gmic_2.9.4_pre201123.tar.gz

Just untar.gz it, go the gmic/gmic-qt then qmake and make, and it should compile the plug-in for GIMP.

EDIT: I’m 90% sure the problem will be fixed :slight_smile:

Thanks.

I built and installed as instructed, but gimp does not show the plugin is installed. Do I need to manually copy files to the gimp folder?

Yes, you have to copy gmic_gimp_qt in the GIMP plug-in folder, indeed.

Well I figured this must be the case and copied gmic_gimp_qt to my plugin folder and gave it a go.

gmic_gimp_qt:419520): Gtk-WARNING **: 15:35:09.070: Theme parsing error: gtk.css:4:1: '/*' in comment block
/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt: fatal error: Segmentation fault
Terminating plug-in: '/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt'
GIMP-Error: Plug-in crashed: "gmic_gimp_qt"
(/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt)

The dying plug-in may have messed up GIMP's internal state. You may want to save your images and restart GIMP to be on the safe side.

Haa bad news.
So, could you do the same procedure as before, compiling it with the fsanitize=address enabled ?
Also, please check that GIMP actually takes the latest binary of the plug-in, sometimes there are duplicates and it’s not always easy to find which binary it loads.

I’ve another idea, anyway.
Will check.

I think I get it now.
Could you please replace the gmic.cpp file in the latest .tar.gz file you downloaded, by this version: https://raw.githubusercontent.com/dtschump/gmic/develop/src/gmic.cpp

I’m confident this time :slight_smile:

I think I was chasing my tail for a while. Should I have tried to make clean between builds?

Anyway, I just deleted the entire build directory and tried again with the new gmic.cpp. Here’s what happened.

(gmic_gimp_qt~:442422): Gtk-WARNING **: 16:32:19.546: Theme parsing error: gtk.css:4:1: '/*' in comment block
/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt~: fatal error: Segmentation fault
Terminating plug-in: '/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt~'
GIMP-Error: Plug-in crashed: "gmic_gimp_qt~"
(/home/akovia/.config/GIMP/2.10/plug-ins/gmic_gimp_qt~)

The dying plug-in may have messed up GIMP's internal state. You may want to save your images and restart GIMP to be on the safe side.

I’m pretty sure I’ve fixed the first issue you got.
It was related to a null pointer, used for a string comparison.

Maybe there are another problem going on.
Again, if you succeed in compiling the stand-alone G’MIC-Qt application, with fsanitize=address enabled, and copy/paste the error log you get from the console, I’ll be able to better understand where the problem comes from, and hopefully fix it.
I’m still a bit surprised about the fact it doesn’t work, but of course, it’s hard to test on all different architectures and compiler versions, so these things may happen from time to time.

Not sure what happened but it’s working now.

Wanted to let you know ASAP so you weren’t going through more code. I’ll test and report

Thanks!

1 Like

Replied at the same time it seems. I’ll put it through it’s paces now.

Can’t thank you enough!

I’m going to sleep now, please let me know if everything looks fine after your tests.
If so, I’ll be able to release new version 2.9.4 with the fixes.

Thanks a lot for the efforts you’ve made and the time you spent on this. It definitely helped improving the G’MIC source code.

I ran it through a long session without any troubles at all. It seems thoroughly fixed.

Thanks again for all your hard work. I would really be lost without this plugin.

Donation OTW.