Segmenation fault in KCmdLineArgs::parseAllArgs()

Dominik Seichter domseichter at web.de
Mon Nov 24 11:55:01 GMT 2003


Hello,

I am the developer of the two KDE applications KBarcode and KRename. Both 
applications have the same strange problem. I can reproduce it for KBarcode 
on my system, but can't with KRename. On other peoples system KRename does 
not work, but KBarcode does. See the this thread for a discussion about the 
problem in KRename: http://www.kbarcode.net/forum/viewtopic.php?t=52.
This problem appears on my system with KDE 3.1.4 as well as with HEAD.
Someone suggested that prelink might cause the problem, but I do not have 
prelink installed on my system.

The problem is that the applications crash in KCmdLineArgs::parseAllArgs() 
(that is what gdb tells me) and the user gets a segmenation fault. 
I think the code I am using is standard KDE code, which should not be 
responsible for such a problem.

The output of strace for KBarcode can be found here: http://
krename.sourceforge.net/data/segfault/kbarcode_strace

The output of gdb from KBarcode can be foud here: http://
krename.sourceforge.net/data/segfault/kbarcode_gdb

The gdb output tells me that the crash is in:
<snip>
KCmdLineArgs::parseAllArgs() () at kcmdlineargs.cpp:552
552            if (option->name[0] == '+')
</snip>
I do not see a solution how this could be fixed in kdelibs, I hope someone can 
come up with a fix.

For now I use the following the solution, all calls to 
KCmdLineArgs::addCmdLineOptions(...) and KCmdLineArgs::parsedArgs() are 
#ifdef'ed out. Without these functions both applications work fine under all 
conditions. The disadvantage of my solution is of course that the users lose 
all commandline options.
Has anyone heard of a similar problem or has even a solution for it?

A recent tarball of KBarcode can be found here: http://
krename.sourceforge.net/data/kbarcode-1.6.0rc1.tar.gz
To reproduce the problem, you have to open kbarcode.h first in your favourite 
editor and uncomment the line
#define NOSEGFAULT

CU Dom
-- 
**********************************************************************
Dominik Seichter - domseichter at web.de
KRename  - http://www.krename.net  - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
KESI     - http://kesi.sf.net      - KESI Easy SQL Import
**********************************************************************





More information about the kde-core-devel mailing list