Bug 314836 - Panorama tool segfault with non-ascii characters in file paths
Summary: Panorama tool segfault with non-ascii characters in file paths
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Generic-Panorama (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-10 17:55 UTC by bug400
Modified: 2020-08-26 03:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.1.0


Attachments
GDB Output (6.53 KB, text/plain)
2013-02-10 19:11 UTC, bug400
Details
Panorama temporary files (339.62 KB, application/x-compressed-tar)
2013-02-10 19:11 UTC, bug400
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bug400 2013-02-10 17:55:53 UTC
Digikam crashes when stitching 2 images i

Reproducible: Always

Steps to Reproduce:
1. select 2 images in digikam
2. choose stitch images into panorama
3. press next on "welcome to panorama tool"
3. press next on list of selected images
4. press next to start preprocessing ("detect moving skies" is checked)
5. press next on image preprocessing is done ("level horizon" and "automatic projection ist checked"

Actual Results:  
digikam crashes.
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff81ffb700 (LWP 3310)]
__memcpy_ssse3 () at ../sysdeps/x86_64/multiarch/memcpy-ssse3.S:2821
(gdb) where
#0  __memcpy_ssse3 () at ../sysdeps/x86_64/multiarch/memcpy-ssse3.S:2821
#1  0x00007ffff26cb9bb in length (this=0x7fff9803abf0)
    at /usr/include/x86_64-linux-gnu/bits/string3.h:52
#2  replaceArgEscapes (s=..., d=..., field_width=0, arg=..., larg=...,
    fillChar=...) at tools/qstring.cpp:6525
#3  0x00007ffff26cbb5d in QString::arg (this=0x7fff81ffa6b0, a=...,
    fieldWidth=0, fillChar=...) at tools/qstring.cpp:6585
#4  0x00007ffff2cbd84b in KLocalizedString::subs (this=<optimized out>, a=...,
    fieldWidth=0, fillChar=...)
    at ../../kdecore/localization/klocalizedstring.cpp:911
#5  0x00007fff77d4cfb5 in i18n<QString> (a1=...,
    text=0x7fff77d5e9c0 "Unknown input file in the project file: %1")
    at /usr/include/klocalizedstring.h:645
#6  KIPIPanoramaPlugin::CreatePreviewTask::run (this=0xfbfb20)
    at /home/precise/digikam3/digikam-3.0.0/extra/kipi-plugins/panorama/tasks/createpreviewtask.cpp:107
#7  0x00007ffff49f105b in ThreadWeaver::JobRunHelper::runTheJob (
    this=0x7fff81ffab00, th=0x63a8750, job=0xfbfb20)
    at ../../../threadweaver/Weaver/Job.cpp:106
#8  0x00007ffff49f11cc in ThreadWeaver::Job::execute (this=0xfbfb20,
    th=0x63a8750) at ../../../threadweaver/Weaver/Job.cpp:135
#9  0x00007ffff49f21d3 in ThreadWeaver::JobCollectionJobRunner::execute (
    this=0xfbabf0, t=0x63a8750)
    at ../../../threadweaver/Weaver/JobCollection.cpp:82
#10 0x00007ffff49f081f in ThreadWeaver::ThreadRunHelper::run (
    this=0x7fff81ffaba0, parent=0x649d8a0, th=0x63a8750)
    at ../../../threadweaver/Weaver/Thread.cpp:95
#11 0x00007ffff49f08db in ThreadWeaver::Thread::run (this=0x63a8750)
    at ../../../threadweaver/Weaver/Thread.cpp:142
#12 0x00007ffff268107b in QThreadPrivate::start (arg=0x63a8750)
    at thread/qthread_unix.cpp:307
#13 0x00007fffeca45e9a in start_thread (arg=0x7fff81ffb700)
    at pthread_create.c:308
#14 0x00007ffff18a8cbd in clone ()
   at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#15 0x0000000000000000 in ?? ()
(gdb) quit


Expected Results:  
show preview window

does not happen when using panoramagui with the same images
Comment 1 Benjamin Girault 2013-02-10 18:34:15 UTC
The error happens at a very strange place, and I'm not sure if it is a problem with the panorama code. Can you provide the debug output also? Thanks.
Comment 2 bug400 2013-02-10 19:11:01 UTC
Created attachment 77100 [details]
GDB Output
Comment 3 bug400 2013-02-10 19:11:33 UTC
Created attachment 77101 [details]
Panorama temporary files
Comment 4 Benjamin Girault 2013-02-10 21:22:17 UTC
I cannot reproduce this bug with two images of a random panorama. Could you send me the original (by private email if you prefer) so that I can pinpoint the problem?
Comment 5 Benjamin Girault 2013-02-11 10:03:12 UTC
After investigation with your files, it appears that the segfault comes from non-ascii characters (accented characters for example) in the file paths. I confirmed this on my computer. This is a bug with the panorama plugin (maybe with the new parser) that will need to be fixed for a future version.

For now, the only way to use the plugin is to avoid non-ascii characters in file paths.
Comment 6 caulier.gilles 2013-02-11 10:22:06 UTC
Typically, with Qt, to pass const char*  string to C ANSI code and respect encoding, use QFile::encodeName() as here :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/common/libkipiplugins/tools/imageio/kpwriteimage.cpp#L267

With KUrl, don't forget to use KUrl::toLocalFile() to prevent problem under Windows as here :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/rawconverter/manager/task.cpp#L121

Gilles
Comment 7 Benjamin Girault 2013-02-11 10:27:00 UTC
(In reply to comment #6)
> Typically, with Qt, to pass const char*  string to C ANSI code and respect
> encoding, use QFile::encodeName() as here :

Thanks for the tip, this might be the problem (I'll look into it this week-end).

> With KUrl, don't forget to use KUrl::toLocalFile() to prevent problem under
> Windows as here :

I always use this function to get the file path, so for this part, it should be fine.
Comment 8 bug400 2013-02-11 10:58:39 UTC
I confirm that there are no problems with the panorama plugin if I use an album path without german umlaute
Comment 9 Benjamin Girault 2013-03-02 21:29:07 UTC
Git commit b84ddbef6f43ec764fa975ba5c7b33d466ef720a by Benjamin Girault.
Committed on 02/03/2013 at 22:21.
Pushed by girault into branch 'master'.

Panorama: bugfix

Fixes char* filename conversion from and to QString

M  +2    -3    panorama/ptoparser/ptofile.cpp
M  +1    -1    panorama/ptoparser/tparser.c
M  +1    -1    panorama/ptoparser/tparser.h
M  +1    -1    panorama/ptoparser/tparserprivate.c
M  +1    -1    panorama/ptoparser/tparserprivate.h

http://commits.kde.org/kipi-plugins/b84ddbef6f43ec764fa975ba5c7b33d466ef720a
Comment 10 Benjamin Girault 2013-03-02 21:36:24 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Typically, with Qt, to pass const char*  string to C ANSI code and respect
> > encoding, use QFile::encodeName() as here :
> 
> Thanks for the tip, this might be the problem (I'll look into it this
> week-end).

For information, this was half of the problem. The other half was that a char* string of a filename needs to be converted into a QString with QString::fromLocal8Bit.