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

Marcel Wiesweg marcel.wiesweg at gmx.de
Sat Dec 16 17:12:36 GMT 2006


------- 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());
 }



More information about the Digikam-devel mailing list