[Digikam-devel] [Bug 134999] New: crash in exiv2 when searching for new images

classic Classic list List threaded Threaded
48 messages Options
123
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 134999] crash in exiv2 when searching for new images

dseifert
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=134999         




------- Additional Comments From dseifert gmx de  2006-12-07 10:18 -------
No change with #38
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 134999] crash in exiv2 when searching for new images

Marcel Wiesweg
In reply to this post by Christian Weiske
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=134999         




------- Additional Comments From marcel.wiesweg gmx de  2006-12-13 23:03 -------
Created an attachment (id=18923)
 --> (http://bugs.kde.org/attachment.cgi?id=18923&action=view)
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.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 134999] crash in exiv2 when searching for new images

dseifert
In reply to this post by Christian Weiske
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=134999         




------- Additional Comments From dseifert gmx de  2006-12-14 09:43 -------
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.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 134999] crash in exiv2 when searching for new images

Gilles Caulier-2
In reply to this post by Christian Weiske
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=134999         
caulier.gilles kdemail net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|NOR                         |VHI



------- Additional Comments From caulier.gilles kdemail net  2006-12-14 12:13 -------
I just toogle this file to VHI because it must be fixed before 0.9.0-final release.

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 134999] crash in exiv2 when searching for new images

Mikael Lammentausta
In reply to this post by Christian Weiske
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=134999         




------- Additional Comments From mikael.lammentausta student savonia-amk fi  2006-12-15 20:31 -------
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());
 }
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 134999] crash in exiv2 when searching for new images

Gilles Caulier-2
In reply to this post by Christian Weiske
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=134999         




------- Additional Comments From caulier.gilles kdemail net  2006-12-16 08:16 -------
Marcel,

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

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 134999] crash in exiv2 when searching for new images

Marcel Wiesweg
In reply to this post by Christian Weiske
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=134999         
marcel.wiesweg gmx de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From marcel.wiesweg gmx de  2006-12-16 18:12 -------
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());
 }
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 134999] crash in exiv2 when searching for new images

Bugzilla from owner@bugs.kde.org
In reply to this post by Christian Weiske
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=134999         
logixoul gmail com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |koch.manuel web de



------- Additional Comments From logixoul gmail com  2007-02-06 00:31 -------
*** Bug 136582 has been marked as a duplicate of this bug. ***
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
123