Bug 134999

Summary: crash in exiv2 when searching for new images
Product: [Applications] digikam Reporter: Christian Weiske <cweiske>
Component: Metadata-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: ahuggel, bugzilla, caulier.gilles, dseifert, koch.manuel
Priority: VHI    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.0
Sentry Crash Report:
Attachments: Disable use of local codec
Use QLatin15codec code
Valgrind output
another valgrind info with the latest QtLatin5codec patch
another valgrind debug
yet more debug info
Fix for QLatin15Codec

Description Christian Weiske 2006-10-02 14:35:28 UTC
Version:           0.9.0_beta2 (using KDE KDE 3.5.2)
Installed from:    Gentoo Packages
OS:                Linux

I copied over some 400 MB of photos to my photo directory. Now when starting digikam, it segfaults while scanning the new pictures. The backtrace:
--------------
[Thread -1250067552 (LWP 21076) exited]
digikam: ScanLib: Nach nicht existierenden Alben suchen: 44 ms

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1240824144 (LWP 21071)]
0xb79c02b1 in Exiv2::ExifKey::clone () from /usr/lib/libexiv2-0.10.so
(gdb) bt
#0  0xb79c02b1 in Exiv2::ExifKey::clone () from /usr/lib/libexiv2-0.10.so
#1  0xb79802e2 in Exiv2::Exifdatum::Exifdatum () from /usr/lib/libexiv2-0.10.so
#2  0xb7983d5e in Exiv2::ExifData::ExifData () from /usr/lib/libexiv2-0.10.so
#3  0xb7ed6064 in Digikam::DMetadata::getImageDateTime ()
   from /usr/lib/libdigikam.so.0
#4  0xb7d783e1 in Digikam::ScanLib::storeItemInDatabase ()
   from /usr/lib/libdigikam.so.0
#5  0xbff29440 in ?? ()
#6  0xbff29460 in ?? ()
#7  0x00000000 in ?? ()
--------------

I am using exiv2 0.10-r1 and digikam 0.9.0_beta2
Comment 1 caulier.gilles 2006-10-02 14:38:23 UTC
This problem have been already reported here.

I recommend you to uninstall Exiv2 0.10 and install new 0.11 release instead.
Recomiple and install digikam and give us a feedback.

Gilles Caulier
Comment 2 Christian Weiske 2006-10-02 15:17:12 UTC
0.11 still crashes:

digikam: ScanLib: Nach nicht existierenden Alben suchen: 82 ms

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1240705360 (LWP 27175)]
0xb79a40fc in Exiv2::Exifdatum::Exifdatum () from /usr/lib/libexiv2-0.11.so
(gdb) bt
#0  0xb79a40fc in Exiv2::Exifdatum::Exifdatum () from /usr/lib/libexiv2-0.11.so
#1  0xb79a7b2e in Exiv2::ExifData::ExifData () from /usr/lib/libexiv2-0.11.so
#2  0xb7efdf34 in Digikam::DMetadata::getImageDateTime ()
   from /usr/lib/libdigikam.so.0
#3  0xb7da0361 in Digikam::ScanLib::storeItemInDatabase ()
   from /usr/lib/libdigikam.so.0
#4  0xbfc42160 in ?? ()
#5  0xbfc42180 in ?? ()
#6  0x00000000 in ?? ()
Comment 3 caulier.gilles 2006-10-02 15:20:51 UTC
Andreas,

There is a new GDB backtrace into Exiv2 here.

Gilles
Comment 4 Andreas Huggel 2006-10-02 16:41:12 UTC
Yes, that's another one of these obscure crashes.

- Can you recreate this with a standalone 'exiv2 <all images>'?
- Is the crash related to one (or a few) specific image(s)? If so, please provide the image.
- The usual one: Can you reproduce this in Valgrind and post the output? 

Thanks,
Andreas
Comment 5 Christian Weiske 2006-10-02 17:01:53 UTC
It seems it is not one specific image, but a concetanation of multiple calls(?)

I could not recreate the crash from commandline.

I started digikam again to find the image which was causing this. It crashed on the 3rd folder. So I moved the 2 first folders away, to get faster to the cause and guess what - it did not crash this time. The scan completed, and digikam started. After moving the 2 folders back and restarting digikam, they were indexed and digikam started without problems. I suppose it was the amount of pictures that gave the problem.

Now moving the folders away to get digikam delete them from the database and moving them back gives the crash again.

Trying the whole thing again with gdb does not give an error. Trying again, again no error. Trying it without gdb lets it crash. But not the next time. I don't know what it is; sometimes it happens and sometimes not.
Comment 6 Christian Weiske 2006-10-02 17:06:27 UTC
Ok, the crash with valgrind output:
--------------
==30650== Invalid write of size 2
==30650==    at 0x5764FA6: QLatin15Codec::toUnicode(char const*, int) const (in /usr/qt/3/lib/libqt-mt.so.3.3.6)
==30650==    by 0x42F849C: Digikam::DMetadata::detectEncodingAndDecode(std::string const&) (in /usr/lib/libdigikam.so.0.0.0)
==30650==    by 0x43AA18B: (within /usr/lib/libdigikam.so.0.0.0)
==30650==  Address 0x5FA5DD8 is 16 bytes before a block of size 20 free'd
==30650==    at 0x4021D9E: realloc (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==30650==    by 0x59908A7: (within /usr/lib/libfontconfig.so.1.0.4)
==30650==
==30650== Invalid write of size 2
==30650==    at 0x5764F79: QLatin15Codec::toUnicode(char const*, int) const (in /usr/qt/3/lib/libqt-mt.so.3.3.6)
==30650==    by 0x42F849C: Digikam::DMetadata::detectEncodingAndDecode(std::string const&) (in /usr/lib/libdigikam.so.0.0.0)
==30650==    by 0x43AA18B: (within /usr/lib/libdigikam.so.0.0.0)
==30650==  Address 0x5F6D100 is not stack'd, malloc'd or (recently) free'd
==30650==
==30650== Conditional jump or move depends on uninitialised value(s)
==30650==    at 0x5764EDC: QLatin15Codec::toUnicode(char const*, int) const (in /usr/qt/3/lib/libqt-mt.so.3.3.6)
==30650==    by 0x42F849C: Digikam::DMetadata::detectEncodingAndDecode(std::string const&) (in /usr/lib/libdigikam.so.0.0.0)
==30650==    by 0x43AA18B: (within /usr/lib/libdigikam.so.0.0.0)
--30650-- memcheck GC: 65536 nodes, 57677 survivors ( 88.0%)
--30650-- memcheck GC: increase table size to 131072
==30650==
==30650== Invalid write of size 2
==30650==    at 0x5764F86: QLatin15Codec::toUnicode(char const*, int) const (in /usr/qt/3/lib/libqt-mt.so.3.3.6)
==30650==    by 0x42F849C: Digikam::DMetadata::detectEncodingAndDecode(std::string const&) (in /usr/lib/libdigikam.so.0.0.0)
==30650==    by 0x43AA18B: (within /usr/lib/libdigikam.so.0.0.0)
==30650==  Address 0x5F9904C is 268 bytes inside a block of size 272 free'd
==30650==    at 0x4021D9E: realloc (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==30650==    by 0x59908A7: (within /usr/lib/libfontconfig.so.1.0.4)
==30650==
==30650== Invalid write of size 2
==30650==    at 0x5764F96: QLatin15Codec::toUnicode(char const*, int) const (in /usr/qt/3/lib/libqt-mt.so.3.3.6)
==30650==    by 0x42F849C: Digikam::DMetadata::detectEncodingAndDecode(std::string const&) (in /usr/lib/libdigikam.so.0.0.0)
==30650==    by 0x43AA18B: (within /usr/lib/libdigikam.so.0.0.0)
==30650==  Address 0x5F9904E is 270 bytes inside a block of size 272 free'd
==30650==    at 0x4021D9E: realloc (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==30650==    by 0x59908A7: (within /usr/lib/libfontconfig.so.1.0.4)

valgrind: m_mallocfree.c:194 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 382, hi = 4048553543.
Probably caused by overrunning/underrunning a heap block's bounds.

==30650==    at 0x38016EBE: (within /usr/lib/valgrind/x86-linux/memcheck)
==30650==    by 0x38016D54: (within /usr/lib/valgrind/x86-linux/memcheck)
==30650==    by 0x3802105D: (within /usr/lib/valgrind/x86-linux/memcheck)
==30650==    by 0x38037238: (within /usr/lib/valgrind/x86-linux/memcheck)
==30650==    by 0x38001950: (within /usr/lib/valgrind/x86-linux/memcheck)
==30650==    by 0x3803964D: (within /usr/lib/valgrind/x86-linux/memcheck)
==30650==    by 0x3804EB8D: (within /usr/lib/valgrind/x86-linux/memcheck)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==30650==    at 0x402165C: operator delete(void*) (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==30650==    by 0x45FAC8F: std::vector<Exiv2::Entry, std::allocator<Exiv2::Entry> >::_M_insert_aux(__gnu_cxx::__normal_iterator<Exiv2::Entry*, std::vector<Exiv2::Entry, std::allocator<Exiv2::Entry> > >, Exiv2::Entry const&) (in /usr/lib/libexiv2-0.11.so)
==30650==    by 0x461FE72: Exiv2::Ifd::add(Exiv2::Entry const&) (in /usr/lib/libexiv2-0.11.so)
==30650==    by 0x4621784: Exiv2::Ifd::read(unsigned char const*, long, long, Exiv2::ByteOrder, long) (in /usr/lib/libexiv2-0.11.so)
==30650==    by 0x46144AE: Exiv2::ExifData::load(unsigned char const*, long) (in /usr/lib/libexiv2-0.11.so)
==30650==    by 0x462B38D: Exiv2::JpegBase::readMetadata() (in /usr/lib/libexiv2-0.11.so)
==30650==    by 0x432B2CF: Digikam::DMetaLoader::loadWithExiv2(QString const&) (in /usr/lib/libdigikam.so.0.0.0)
--------------


Could it be something with the German umlauts (äöüÄÖÜß) I'm using in my filenames? 
Comment 7 Christian Weiske 2006-10-02 17:08:42 UTC
Crash a bit faster:

==30681==    at 0x402165C: operator delete(void*) (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==30681==    by 0x464DFB1: Exiv2::ExifKey::~ExifKey() (in /usr/lib/libexiv2-0.11.so)
==30681==    by 0x460D2EE: Exiv2::Exifdatum::~Exifdatum() (in /usr/lib/libexiv2-0.11.so)
==30681==    by 0x461980B: std::vector<Exiv2::Exifdatum, std::allocator<Exiv2::Exifdatum> >::_M_insert_aux(__gnu_cxx::__normal_iterator<Exiv2::Exifdatum*, std::vector<Exiv2::Exifdatum, std::allocator<Exiv2::Exifdatum> > >, Exiv2::Exifdatum const&) (in /usr/lib/libexiv2-0.11.so)
==30681==    by 0x461420F: Exiv2::ExifData::add(Exiv2::Exifdatum const&) (in /usr/lib/libexiv2-0.11.so)
==30681==    by 0x461431B: Exiv2::ExifData::add(__gnu_cxx::__normal_iterator<Exiv2::Entry const*, std::vector<Exiv2::Entry, std::allocator<Exiv2::Entry> > >, __gnu_cxx::__normal_iterator<Exiv2::Entry const*, std::vector<Exiv2::Entry, std::allocator<Exiv2::Entry> > >, Exiv2::ByteOrder) (in /usr/lib/libexiv2-0.11.so)
==30681==    by 0x46147D2: Exiv2::ExifData::load(unsigned char const*, long) (in /usr/lib/libexiv2-0.11.so)
==30681==    by 0x462B38D: Exiv2::JpegBase::readMetadata() (in /usr/lib/libexiv2-0.11.so)
==30681==    by 0x432B2CF: Digikam::DMetaLoader::loadWithExiv2(QString const&) (in /usr/lib/libdigikam.so.0.0.0)

Comment 8 Andreas Huggel 2006-10-03 03:58:15 UTC
Gilles,

Is there a quick way to bypass the call to QLatin15Codec::toUnicode called by Digikam::DMetadata::detectEncodingAndDecode and try again? 

According to the trace in #6 this call is corrupting memory. I wonder if this would make Valgrind happy.

-ahu.
Comment 9 caulier.gilles 2006-10-03 18:27:18 UTC
*** Bug 135051 has been marked as a duplicate of this bug. ***
Comment 10 Janet 2006-10-03 18:32:31 UTC
Have found a limit by adding/deleting files in "dummy"-directory: it crashes the same way with smaller directory with 438 files (396,1 MB). Does not crash with directory containing 437 files total (394,7 MB).

It has nothing to do with spaces in folder- or filenames and is independent from image formats or if folders contain other files than pictures too.
Comment 11 caulier.gilles 2006-10-04 13:39:29 UTC
Andreas,

In dmetadata.cpp, just comments lines 1101 to 1134 and try again. The String will be just converted to Ascii.

Marcel, you have written this source code in DMetadata. Are you a suggestion about the crash ?

Gilles
Comment 12 Marcel Wiesweg 2006-10-04 16:10:26 UTC
The valgrind output suggests a problem with Qt's codec (but we must not forget that the codec operates on std::string data supplied by libexiv2, so if we pass invalid data that could be the reason.)

The backtraces at comment #7 and #6 happen during a delete operation in exiv2, the backtrace from 135051 when a std::string is deleted.
These crashes on delete might suggest that somewhere heap management memory is overwritten.

If the crash is reproducible for someone, could you comment out the lines as Gilles said and check if it solves the problem?
Janet, otherwise, can you perhaps provide a valgrind report?
Comment 13 Andreas Huggel 2006-11-18 01:33:08 UTC
Christian, Janet,

We suspect this is a duplicate of bug #136855 and need your feedback to confirm if the problem is solved.

If you can still recreate this please try again with the latest Exiv2/digiKam/kipi-plugins from SVN. You need to compile and install Exiv2 first and cleanup digiKam/kipi-plugins before recompiling and installing it. 

Please report if the problem still occurs. Thanks!

-ahu.
Comment 14 Mikael Lammentausta 2006-11-18 23:09:28 UTC
I too experience a similar crash, when trying to scan some folders on my collection.

I installed exiv2 from SVN manually, then digikam from SVN via the svn-ebuild from kde-experimental on Gentoo.

Here's the backtrace.

GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/digikam
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 26585)]
[New Thread 32769 (LWP 26588)]
[New Thread 16386 (LWP 26589)]
[Thread 16386 (LWP 26589) exited]
[New Thread 32771 (LWP 26590)]
[Thread 32771 (LWP 26590) exited]
digikam: ScanLib: Etsitään tietokannasta poistettuja albumeja: 64 ms
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:38:26','img_2234.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:38:31','img_2235.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:38:48','img_2236.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:39:17','img_2237.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:39:35','img_2238.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:39:46','img_2239.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:39:51','img_2240.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:40:35','img_2241.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:40:48','img_2242.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:40:59','img_2243.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:54:53','img_2244.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-04T16:55:36','img_2245.jpg',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T22:37:42','Thumbs.db',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-06T20:00:50','ZbThumbnail.info',107)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:42:54','img_2246.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:43:07','img_2247.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:43:17','img_2248.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:43:45','img_2249.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:44:24','img_2250.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:45:18','img_2251.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:45:32','img_2252.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:45:58','img_2253.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:46:17','img_2254.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:46:33','img_2255.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:46:39','img_2256.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:46:45','img_2257.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:46:54','img_2258.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:46:58','img_2259.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:47:13','img_2260.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:47:39','img_2261.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:47:54','img_2262.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:48:02','img_2263.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:48:38','img_2264.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:48:52','img_2265.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:49:14','img_2266.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T05:49:46','img_2267.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:38:40','img_2268.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:39:01','img_2269.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:39:06','img_2270.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:39:10','img_2271.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:39:30','img_2272.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:39:48','img_2273.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:40:06','img_2274.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:40:13','img_2275.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:40:23','img_2276.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:40:39','img_2277.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:40:43','img_2278.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T10:40:53','img_2279.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:06:03','img_2280.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:06:14','img_2281.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:06:51','img_2282.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:07:07','img_2283.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:12:22','img_2284.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:12:29','img_2285.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:12:41','img_2286.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:12:55','img_2287.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:34:52','img_2288.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:35:06','img_2289.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:35:14','img_2290.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:35:24','img_2291.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:35:35','img_2292.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:35:42','img_2293.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:36:05','img_2294.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:36:16','img_2295.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:36:22','img_2296.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:36:58','img_2297.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:37:08','img_2298.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:37:30','img_2299.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:38:08','img_2300.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:38:16','img_2301.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:40:12','img_2302.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:40:24','img_2303.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T15:40:33','img_2304.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T18:46:05','img_2305.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T18:46:15','img_2306.jpg',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T22:37:42','Thumbs.db',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-10T22:08:34','ZbThumbnail.info',108)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T19:47:59','img_2307.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T19:48:34','img_2308.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T19:48:46','img_2309.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T19:48:53','img_2310.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T19:49:00','img_2311.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:10:48','img_2820.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:10:58','img_2821.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:11:10','img_2822.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:11:16','img_2823.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:11:29','img_2824.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:11:35','img_2825.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:11:46','img_2826.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:11:59','img_2827.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:12:16','img_2828.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:12:49','img_2829.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:12:59','img_2830.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:13:03','img_2831.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:13:11','img_2832.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:13:16','img_2833.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:13:20','img_2834.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:14:03','img_2835.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:14:13','img_2836.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:14:15','img_2837.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:14:17','img_2838.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:14:20','img_2839.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-12T15:14:23','img_2840.jpg',109)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-13T17:31:23','img_2312.jpg',110)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-13T17:31:36','img_2313.jpg',110)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T22:37:42','Thumbs.db',110)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T22:38:06','ZbThumbnail.info',110)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T00:04:38','img_2315.jpg',111)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T00:04:47','img_2316.jpg',111)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T00:05:53','img_2317.jpg',111)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T00:06:14','img_2318.jpg',111)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T01:04:20','mvi_2314.avi',111)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T00:04:20','mvi_2314.thm',111)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T22:37:42','Thumbs.db',111)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-06-14T22:23:32','ZbThumbnail.info',111)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-11T14:33:34','img_1340.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-11T15:10:31','img_1341.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-11T15:10:46','img_1342.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-11T15:15:58','img_1343.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-11T15:49:13','img_1344.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-11T16:12:06','img_1345.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-11T16:12:17','img_1346.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:22:12','Kuva 001.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:22:18','Kuva 002.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:22:23','Kuva 003.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:22:28','Kuva 004.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:50:19','Kuva 005.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:50:35','Kuva 006.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:50:50','Kuva 007.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:51:12','Kuva 008.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:51:38','Kuva 009.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:52:31','Kuva 010.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:53:14','Kuva 011.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:53:48','Kuva 012.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:54:25','Kuva 013.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:54:50','Kuva 014.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:55:22','Kuva 015.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:56:10','Kuva 016.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:56:29','Kuva 017.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:57:09','Kuva 018.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:58:19','Kuva 019.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T13:58:21','Kuva 020.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:08:06','Kuva 021.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:08:13','Kuva 022.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:08:27','Kuva 023.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:08:37','Kuva 024.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:08:56','Kuva 025.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:09:13','Kuva 026.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:09:20','Kuva 027.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:09:29','Kuva 028.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:09:37','Kuva 029.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:12:41','Kuva 030.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:13:00','Kuva 031.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:13:20','Kuva 032.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:13:26','Kuva 033.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:13:32','Kuva 034.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:44:45','Kuva 035.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:44:50','Kuva 036.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:45:03','Kuva 037.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:45:12','Kuva 038.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:45:21','Kuva 039.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:45:32','Kuva 040.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:46:08','Kuva 041.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:46:15','Kuva 042.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:46:37','Kuva 043.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:46:48','Kuva 044.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:47:18','Kuva 045.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:47:37','Kuva 046.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:47:44','Kuva 047.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:48:01','Kuva 048.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:48:09','Kuva 049.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:48:21','Kuva 050.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:48:28','Kuva 051.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:48:36','Kuva 052.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:48:46','Kuva 053.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:48:52','Kuva 054.jpg',112)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2006-02-04T14:49:01','Kuva 055.jpg',112)
terminate called after throwing an instance of 'std::bad_alloc'
  what():  St9bad_alloc

Program received signal SIGABRT, Aborted.
[Switching to Thread 16384 (LWP 26585)]
0xb6093b31 in kill () from /lib/libc.so.6
(gdb) bt
#0  0xb6093b31 in kill () from /lib/libc.so.6
#1  0xb6443c79 in pthread_kill () from /lib/libpthread.so.0
#2  0xb6443fcd in raise () from /lib/libpthread.so.0
#3  0xb60938dc in raise () from /lib/libc.so.6
#4  0xb6094ca4 in abort () from /lib/libc.so.6
#5  0xb6246607 in __gnu_cxx::__verbose_terminate_handler () from /usr/lib/gcc/i686-pc-linux-gnu/3.4.4/libstdc++.so.6
#6  0xb6244441 in __cxa_call_unexpected () from /usr/lib/gcc/i686-pc-linux-gnu/3.4.4/libstdc++.so.6
#7  0xb6244476 in std::terminate () from /usr/lib/gcc/i686-pc-linux-gnu/3.4.4/libstdc++.so.6
#8  0xb6244623 in __cxa_rethrow () from /usr/lib/gcc/i686-pc-linux-gnu/3.4.4/libstdc++.so.6
#9  0xb7907282 in ExifData (this=0xbfa9d1f0, rhs=@0x81b7c3c) at stl_uninitialized.h:92
#10 0xb7e58dd0 in Digikam::DMetadata::getImageDateTime () from /usr/lib/libdigikam.so.0
#11 0xb7d00382 in Digikam::ScanLib::storeItemInDatabase () from /usr/lib/libdigikam.so.0
#12 0xbfa9d2d0 in ?? ()
#13 0xbfa9d300 in ?? ()
#14 0x00000000 in ?? ()
(gdb)  
Comment 15 Mikael Lammentausta 2006-11-18 23:16:50 UTC
I must add that the crashes happen with photos that were taken on certain cameras  (Canon Ixus 700 and Canon EOS350D) and transferred with some unknown Windows software. I'll have to look into my collection more closely and isolate the broken files. Any suggestions what tools to use to fix the exif fields? 

Can I provide any help to debug this further? 

I guess a workaround would be to a) fix exiv2 or b) ensure the validity of the metadata fields before calling the libexiv2 library.
Comment 16 Andreas Huggel 2006-11-19 05:34:13 UTC
> Can I provide any help to debug this further? 

Yes please, see comment #4.
-ahu.
Comment 17 Marcel Wiesweg 2006-11-19 15:22:27 UTC
Mikael, what about all these "database disk image is malformed" messages? This means to me that the digikam3.db file is corrupt. Does digikam work as expected when you exclude the allegedly broken files? What happens if you rename your digikam3.db and start with a fresh database (except that your tags are missing)? Can the "sqlite3" command line utility access the database and execute the statements from your log ("REPLACE INTO...;")?
Comment 18 Daniel Seifert 2006-12-03 23:04:45 UTC
Same problem here (digicam 0.9.0 rc1 on gentoo, exiv2-0.11), trying to import more than 5000 jpeg files (disk size 8 GB). keywords and comments have been added using exiftools and some exist from the camera (Canon ixus) and iPhoto, images are scattered among quite a few (sub)directories.

digikam3.db file has been deleted and at startup digikam starts to scan the images, invariably leading to a crash (not always at the exact same position it seems)

[...]
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('','2004-08-07T16:56:51','133_3337.JPG',35)
digikam: WARNING: sqlite_step error: database disk image is malformed on query: SELECT Images.name FROM Images WHERE Images.dirid=36
*** glibc detected *** digikam: corrupted double-linked list: 0x08182080 ***
======= Backtrace: =========
/lib/libc.so.6[0xb6361bab]
/lib/libc.so.6[0xb6361c5e]
/lib/libc.so.6[0xb63637a0]
/lib/libc.so.6(malloc+0x74)[0xb636522e]
/usr/lib/libsqlite3.so.0(sqlite3GenericMalloc+0x1d)[0xb7c38dfd]
/usr/lib/libsqlite3.so.0(sqlite3MallocRaw+0x36)[0xb7c4de5c]
/usr/lib/libsqlite3.so.0(sqlite3Malloc+0x26)[0xb7c4e00c]
/usr/lib/libsqlite3.so.0(sqlite3MallocX+0x25)[0xb7c4e107]
/usr/lib/libsqlite3.so.0(sqlite3ParserAlloc+0x10)[0xb7c3c676]
/usr/lib/libsqlite3.so.0(sqlite3RunParser+0x35)[0xb7c4a4f8]
/usr/lib/libsqlite3.so.0(sqlite3_prepare+0xcc)[0xb7c4169f]
/usr/lib/libdigikam.so.0(_ZN7Digikam7AlbumDB7execSqlERK7QStringP11QStringListb+0x76)[0xb7d5e97c]
/usr/lib/libdigikam.so.0(_ZN7Digikam7AlbumDB7addItemEiRK7QStringRK9QDateTimeS3_iR11QStringList+0x13b)[0xb7d64913]
/usr/lib/libdigikam.so.0(_ZN7Digikam7ScanLib19storeItemInDatabaseERK7QStringS3_i+0x28e)[0xb7db47e2]
/usr/lib/libdigikam.so.0(_ZN7Digikam7ScanLib8allFilesERK7QString+0x591)[0xb7db5d39]
/usr/lib/libdigikam.so.0(_ZN7Digikam7ScanLib8allFilesERK7QString+0x546)[0xb7db5cee]
/usr/lib/libdigikam.so.0(_ZN7Digikam7ScanLib16findMissingItemsEv+0x352)[0xb7db6578]
/usr/lib/libdigikam.so.0(_ZN7Digikam7ScanLib9startScanEv+0x1ac)[0xb7db6800]
/usr/lib/libdigikam.so.0(_ZN7Digikam12AlbumManager14setLibraryPathERK7QString+0x43c)[0xb7d55bf2]
digikam(main+0x8d8)[0x804a378]
/lib/libc.so.6(__libc_start_main+0xdc)[0xb6316864]
digikam(_ZN6QGList5clearEv+0x95)[0x8049a21]


Last relevant valgrind output

==13973== Invalid write of size 2
==13973==    at 0x5601FFD: QLatin15Codec::toUnicode(char const*, int) const (in /usr/qt/3/lib/libqt-mt.so.3.3.6)
==13973==    by 0x42EDC9E: Digikam::DMetadata::detectEncodingAndDecode(std::string const&) (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x42F6611: Digikam::DMetadata::convertCommentValue(Exiv2::Exifdatum const&) (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x42FB012: Digikam::DMetadata::getImageComment() const (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x417168E: Digikam::ScanLib::storeItemInDatabase(QString const&, QString const&, int) (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x4172D38: Digikam::ScanLib::allFiles(QString const&) (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x4172CED: Digikam::ScanLib::allFiles(QString const&) (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x4173577: Digikam::ScanLib::findMissingItems() (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x41737FF: Digikam::ScanLib::startScan() (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x4112BF1: Digikam::AlbumManager::setLibraryPath(QString const&) (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x804A377: main (in /usr/bin/digikam)
==13973==  Address 0x5F4D074 is 12 bytes before a block of size 24 free'd
==13973==    at 0x401FCD2: operator delete(void*) (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==13973==    by 0x5B7298E: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/libstdc++.so.6.0.8)
==13973==    by 0x45F9752: Exiv2::ExifKey::makeKey() (in /usr/lib/libexiv2-0.11.so)
==13973==    by 0x45F9A49: Exiv2::ExifKey::ExifKey(Exiv2::Entry const&) (in /usr/lib/libexiv2-0.11.so)
==13973==    by 0x45BD0A6: Exiv2::Exifdatum::Exifdatum(Exiv2::Entry const&, Exiv2::ByteOrder) (in /usr/lib/libexiv2-0.11.so)
==13973==    by 0x45C2447: Exiv2::ExifData::add(__gnu_cxx::__normal_iterator<Exiv2::Entry const*, std::vector<Exiv2::Entry, std::allocator<Exiv2::Entry> > >, __gnu_cxx::__normal_iterator<Exiv2::Entry const*, std::vector<Exiv2::Entry, std::allocator<Exiv2::Entry> > >, Exiv2::ByteOrder) (in /usr/lib/libexiv2-0.11.so)
==13973==    by 0x45C2A24: Exiv2::ExifData::load(unsigned char const*, long) (in /usr/lib/libexiv2-0.11.so)
==13973==    by 0x45D5B51: Exiv2::JpegBase::readMetadata() (in /usr/lib/libexiv2-0.11.so)
==13973==    by 0x4300F3E: Digikam::DMetaLoader::loadWithExiv2(QString const&) (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x4301365: Digikam::JPEGMetaLoader::load(QString const&) (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x42EDAB1: Digikam::DMetadata::load(QString const&, Digikam::DImg::FORMAT) (in /usr/lib/libdigikam.so.0.0.0)
==13973==    by 0x42FA167: Digikam::DMetadata::DMetadata(QString const&, Digikam::DImg::FORMAT) (in /usr/lib/libdigikam.so.0.0.0)

HTH and would appreciate any pointers on how to fix this in the files.
Comment 19 Andreas Huggel 2006-12-04 02:20:25 UTC
Daniel,
Please upgrade to Exiv2 0.12 and try again.
-ahu.
Comment 20 Daniel Seifert 2006-12-04 08:44:11 UTC
No difference with exiv2 0.12.
Comment 21 caulier.gilles 2006-12-04 09:14:17 UTC
Take a care to uninstall properlly old Exiv2 0.11, clean up digiKam source code and recompile all (digiKam/DigiakmaImagePlugins/Kipi-plugins)... else you will see no difference. Of course, use RC1 source code tarball or better current implementation from KDE svn.

Gilles
Comment 22 Andreas Huggel 2006-12-04 09:38:48 UTC
Ok thanks. Can you investigate further:

- what system are you runnning this on (32 or 64bit)?
- can you recreate this with a standalone 'exiv2 -pt *.jpg'?
- is the crash related to specific images? 
- what cameras are the images from (what makernotes do they contain), all from Canon ixus?

-ahu.
Comment 23 Mikael Lammentausta 2006-12-04 10:03:08 UTC
Daniel, it seems you have the same problem. I haven't had the time yet to do a closer investigation (I really should since this should be fixed in 0.9 final in late December). 

What I know now: 
 - my filesystem (and glibc libraries) are ISO8859-1x. digiKam always crashes when it tries to scan folders that have non-ASCII characters.
 - it is not always the same folders that are scanned during the crash.
 - after the crash, 'free' function is not called and the kernel does not clear up the malloc'ed memory. I may lose several megabytes of free RAM with a single crash.
 - the crashes come quicker when there is less free RAM
 - the pictures than with Canon Ixus and transferred in Windows (then moved to Linux FS) may be a source of one problem
 - some pictures than with Canon Axx cameras and transferred via digiKam (all  versions since 0.8) are a cause for some malformed queries.

Comment 24 Daniel Seifert 2006-12-04 10:53:03 UTC
Gilles: I recompiled exiv2, digikam 0.9.0 RC1 and the plugins from scratch, so this was a clean install (Gentoo ebuilds). Still crashes, but read on.

Andreas:
 - I am running on 32bit. 
 - I don't see a problem with exiv2 -pt * */* */*/* (my images are not all in the same directory), at least it does not end with a crash (I didn't really have the time to read through all the stdout (40MB), though). On stderr I didn't see anything related to a crash.
 - The crash is not related to specific images, at least the crash does not happen with the same images or even directories each time. In fact, I am now making progress in adding my images to digikam by copying one folder at a time (i.e. 10-50 images) and having digikam rescan them. I suspect that some images cause digikam to mess up something which manifests itself in a crash at a later time. I.e. I copied 8 directories with a total of 460 images into digikam's directory and digikam crashed when scanning them. When I copied+rescanned each directory individually, digikam did not crash.
 - The images are 99% from Canon Ixus (II and 400, I think)

The makernotes are a bit messed up, as I am switching from iPhoto (MacOS X) and when modifying the images in iPhoto the offsets become incorrect. I did add comments and keywords to most images using exiftool, but at the moment exiftool does not fix the offset (there should be an update soon). 

The filenames and folders do not contain non-ascii characters (anymore).

Comment 25 Daniel Seifert 2006-12-04 13:05:07 UTC
Update: after continuing to copy images in small steps to digikam, I got 7 of 8 GB to the database without problems. But now I am left with a number of images (many, but not all, copied over from Windows) that cause digiKam to output things like

digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, name, dirid )  VALUES ('64-Bit RAID-Karte','2004-08-09T16:05:37','IMG_0793.JPG',26)

and so on. Even adding one of these images now causes an error message, trying to add many will eventuall lead to a crash (see above). Removing the digikam3.db file and only adding one of these images does not give any warning, so it does not seem to be the image itself that causes the problem, it only seems to trigger another problem in the database.

This whole issue looks like at some point something is being messed up (in RAM and/or in the database) but only causes a problem later on. I don't have any ideas left what to do. If anyone wants me to try something, please let me know.
Comment 26 Marcel Wiesweg 2006-12-04 16:27:34 UTC
Created attachment 18781 [details]
Disable use of local codec

To test if the valgrind report about QLatin15Codec is the problem, please try
the attached patch, which disables the use of this codec.
Comment 27 Daniel Seifert 2006-12-04 22:26:20 UTC
I've compiled 0.9.0 rc1 from hand now (as opposed to using the ebuild) and added debug as well. I've applied your patch.

For the first test, I am running digikam in a directory with about 1700 images. Adding them in small steps works fine, there are no error messages regarding makernotes and no warnings/errors from sqlite on the console. Adding them all at once (i.e. removing digikam3.db and running digikam which will scan the directory) will reliably cause a crash with the unmodified 0.9.0 rc1 tarball.

When running the patched version on the same images, there is no crash.

Next, I copied all my images (6000 images, 8 GB) into digikam's directory, removed digicam3.db and started digikam. It took some time to scan, but there were neither sqlite warnings or errors about malformed disk images, and there is also no crash.

As far as I can tell, the patch solved the problem. Let me know if you want me to run further tests, but so far I am quite happy :-)
Comment 28 Andreas Huggel 2006-12-05 02:39:20 UTC
Could this be related (reported for Qt 4.2.0 though)?

http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=135482

Does it make sense to try the workaround mentioned there to check?

-ahu.
Comment 29 Marcel Wiesweg 2006-12-05 22:42:51 UTC
Created attachment 18807 [details]
Use QLatin15codec code

Here is another patch (for debugging only). It uses the code of
QLatin15Codec::toUnicode to find out where exactly the crash happens. There is
also a debug output for each image, so expect large logs.
The question is, does the crash occur with this as well (the code is the same),
which line does valgrind point to, what is the debug output before the
crash/valgrind error.
Comment 30 Daniel Seifert 2006-12-06 00:21:24 UTC
Created attachment 18809 [details]
Valgrind output

I've applied this change and ran digikam several times. I've attached a file
with the last few lines in each run's output. Please let me know if you want me
to do further tests.
Comment 31 Mikael Lammentausta 2006-12-06 15:50:04 UTC
Created attachment 18816 [details]
another valgrind info with the latest QtLatin5codec patch

I patched digikam-0.9.0_rc1 with the latest debug patch and the --debug useflag
on Gentoo. Here is the output from valgrind digikam &>
digikam-QTpatch-valgrind.

The album path to scan is my whole photo collection (43 GB).
Comment 32 Mikael Lammentausta 2006-12-06 17:16:14 UTC
GDB debug output with the patch over the collection is similar to what is already reported. digiKam scanned for about 10 minutes, then crashed. Here are the last lines:

digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, na
me, dirid )  VALUES ('','2005-09-22T09:34:55','IMG_9815.JPG',2243)
digikam: detectEncodingAndDecode 256 0
digikam: WARNING: sqlite_step error: database disk image is malformed on query: REPLACE INTO Images ( caption , datetime, na
me, dirid )  VALUES ('','2005-09-22T11:34:08','IMG_9816.JPG',2243)
digikam: detectEncodingAndDecode 256 0
Comment 33 Mikael Lammentausta 2006-12-06 17:31:07 UTC
Created attachment 18818 [details]
another valgrind debug

 $ time valgrind digikam &> digikam-QTpatch-valgrind2


real	1m57.633s
user	1m17.373s
sys	0m1.579s
Comment 34 Mikael Lammentausta 2006-12-06 17:46:48 UTC
Created attachment 18819 [details]
yet more debug info

I've removed digikam.db3 from the album root, but there are more digikam.db3s
inside some subfolders. Do they matter or should I remove them too? Below is
shown that digiKam hogs close to 200MBs of RAM that isn't freed. This is run
after a clean reboot.

 $ free
	     total	 used	    free     shared    buffers	   cached
Mem:	   1032996     506540	  526456	  0	 27780	   248400
-/+ buffers/cache:     230360	  802636
Swap:	    746980	    0	  746980
mikael@planck ~ 18:41:22
 $ time valgrind digikam &> digikam-QTpatch-valgrind4

real	1m13.320s
user	1m9.043s
sys	0m1.056s
mikael@planck ~ 18:42:38
 $ free
	     total	 used	    free     shared    buffers	   cached
Mem:	   1032996     683212	  349784	  0	 28832	   323008
-/+ buffers/cache:     331372	  701624
Swap:	    746980	    0	  746980
Comment 35 Marcel Wiesweg 2006-12-06 20:14:08 UTC
Thanks for your testing. All your debug logs seem to show the same problem.

What is happening before valgrind reports an error:

digikam: detectEncodingAndDecode 256 0
==28542== 
==28542== Invalid write of size 2
==28542==    at 0x4325A3A: Digikam::DMetadata::detectEncodingAndDecode(std::string const&) (dmetadata.cpp:1225)

There is an image comment, a std::string object. The string says its length is 256, strlen says the length is 0, which means the first character is \0. This happens always before valgrind errors, for the "normal" comments, string::length() and strlen agree on the string length.
Then, in the code from QLatin15Codec, there seems to be a off-by-one problem. (It operates on ushort, 2 bytes). This code does not check the length parameter passed from digikam.
The Latin15 codec differs from Latin1 only in 8 of 256 values, so only if the bytes following the memory area have one of these values, they will be changed, and a crash seems to occur if some of glibc's memory management bytes are overwritten.

I will do some tests or think about what is the actual problem.
Comment 36 Mikael Lammentausta 2006-12-06 21:47:52 UTC
Here's additional information of my glibc, if this matters:

[U] sys-libs/glibc
     Installed versions:  2.3.4.20041102-r1(2.2)(20:50:47 19.01.2006)(-build -erandom -hardened -multilib nls -nomalloccheck -nptl -nptlonly -pic -selinux -userlocales)
     Homepage:            http://www.gnu.org/software/libc/libc.html
     Description:         GNU libc6 (also called glibc2) C library

 $ /lib/libc-2.3.4.so
GNU C Library 20041102 release version 2.3.4, by Roland McGrath et al.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1).
Compiled on a Linux 2.6.11 system on 2005-10-20.
Available extensions:
        GNU libio by Per Bothner
        crypt add-on version 2.1 by Michael Glad and others
        linuxthreads-0.10 by Xavier Leroy
        The C stubs add-on version 2.1.2.
        GNU Libidn by Simon Josefsson
        BIND-8.2.3-T5B
        libthread_db work sponsored by Alpha Processor Inc
        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Comment 37 Daniel Seifert 2006-12-06 23:20:10 UTC
Marcel, would it help you if I send you (where to?) an image which has this discrepancy in length? This image does not seem to have any comment.

I have other photos WITH comments that also cause this problem. They seem to be a bit "strange", sometimes not even displayed with exiv2, although after #26 they were imported just fine, it seems.
Comment 38 Andreas Huggel 2006-12-07 02:30:08 UTC
Please try this on top of Marcel's patch. It assumes c_str() only allocates memory up to the first 0 byte.

--- dmetadata.cpp       2006-12-07 09:05:02.000000000 +0800
+++ dmetadata2.cpp      2006-12-07 09:18:36.000000000 +0800
@@ -1195,8 +1195,8 @@
     // Use whatever has the larger score, local or ASCII
     if (localScore >= 0 && localScore >= latin1Score)
     {
-        //return localCodec->toUnicode(value.c_str(), value.length());
-        const char *chars = value.c_str();
+        //return localCodec->toUnicode(value.data(), value.length());
+        const char *chars = value.data();
         uint len = value.length();

         // Code from QLatin15Codec::toUnicode

-ahu.
Comment 39 Daniel Seifert 2006-12-07 10:18:39 UTC
No change with #38
Comment 40 Marcel Wiesweg 2006-12-13 23:03:31 UTC
Created attachment 18923 [details]
Fix for QLatin15Codec

Please test if this patch fixes the problem.
As far as I can see, it's a problem of the QLatin15Codec. It uses
QString::fromLatin1 internally. The returned string is only as long as strlen
returns. However, the length parameter passed to toUnicode is sometimes longer,
especially with image comments which contain only 256 "\0". The buffer has
length 0, QLatin15Codec does not check this again, believes it is 256 bytes.
Comment 41 Daniel Seifert 2006-12-14 09:43:59 UTC
I don't think your codec name check works.

Changing code to

  int length = value.length();
  DDebug() << "length: " << length << ", real len " << strlen(value.c_str()) << " and using codec " << localCodec->name() << endl;
  if (localCodec->name() == "ISO 8859-15") {
    length = strlen(value.c_str());
    DDebug() << "8859-15, updating length to " << length << endl;
  }

will output
 
digikam: file /home/dseifert/Bilder/2003/2003-12 Weihnachten/103_0301.JPG
digikam: done
digikam: length: 256, real len 0 and using codec ISO 8859-15
==15719==
==15719== Invalid write of size 2
==15719==    at 0x563D03B: QLatin15Codec::toUnicode(char const*, int) const (in /usr/qt/3/lib/libqt-mt.so.3.3.6)
==15719==    by 0x4325979: Digikam::DMetadata::detectEncodingAndDecode(std::string const&) (dmetadata.cpp:1207)

i.e. even though localCodec->name() returns "ISO 8859-15" it doesn't go into the if-clause.

I changed it to 

   if (strcmp(localCodec->name(), "ISO 8859-15") == 0)

and I was able to parse my whole collection of images without a crash or a corrupted database.
Comment 42 caulier.gilles 2006-12-14 12:13:09 UTC
I just toogle this file to VHI because it must be fixed before 0.9.0-final release.

Gilles
Comment 43 Mikael Lammentausta 2006-12-15 20:31:59 UTC
Fabulous! I just successfully scanned my entire collection. :)

I used the correction suggested by Daniel, that is:

Index: libs/dmetadata/dmetadata.cpp
===================================================================
--- libs/dmetadata/dmetadata.cpp        (revision 613266)
+++ libs/dmetadata/dmetadata.cpp        (working copy)
@@ -1209,7 +1209,14 @@
     // convert string:
     // Use whatever has the larger score, local or ASCII
     if (localScore >= 0 && localScore >= latin1Score)
-        return localCodec->toUnicode(value.c_str(), value.length());
+    {
+        // workaround for bug #134999:
+        // The QLatin15Codec may crash if strlen < value.length()
+        int length = value.length();
+        if (strcmp(localCodec->name(), "ISO 8859-15") == 0)
+            length = strlen(value.c_str());
+        return localCodec->toUnicode(value.c_str(), length);
+    }
     else
         return QString::fromLatin1(value.c_str());
 }
Comment 44 caulier.gilles 2006-12-16 08:16:40 UTC
Marcel,

What do you think about this patch ? Can be included into svn before 0.9.0-final release ?

Gilles
Comment 45 Marcel Wiesweg 2006-12-16 18:12:35 UTC
SVN commit 614178 by mwiesweg:

Workaround for problem in QLatin15Codec.
The string provided as comment may contain \0 characters (often 256 '\0').
QLatin15Codec uses QString::fromLatin1 internally, which stops at the first \0.
Then QLatin15Codec does not check if the string returned is shorter than
the length provided to toUnicode. This means we have to adjust the string length
to strlen() if QLatin15Codec is used.

BUG: 134999


 M  +8 -1      dmetadata.cpp  


--- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp #614177:614178
@@ -1209,7 +1209,14 @@
     // convert string:
     // Use whatever has the larger score, local or ASCII
     if (localScore >= 0 && localScore >= latin1Score)
-        return localCodec->toUnicode(value.c_str(), value.length());
+    {
+        // workaround for bug #134999:
+        // The QLatin15Codec may crash if strlen < value.length()
+        int length = value.length();
+        if (localCodec->name() == QString::fromLatin1("ISO 8859-15"))
+            length = strlen(value.c_str());
+        return localCodec->toUnicode(value.c_str(), length);
+    }
     else
         return QString::fromLatin1(value.c_str());
 }
Comment 46 Stefan Monov 2007-02-06 00:31:22 UTC
*** Bug 136582 has been marked as a duplicate of this bug. ***