[Digikam-devel] [Bug 139766] New: Crash when displaying EXIF metadata with Unicode comment

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

[Digikam-devel] [Bug 139766] New: Crash when displaying EXIF metadata with Unicode comment

Leonid Zeitlin
------- 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=139766         
           Summary: Crash when displaying EXIF metadata with Unicode comment
           Product: digikam
           Version: 0.9.0
          Platform: Fedora RPMs
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: crash
          Priority: NOR
         Component: Metadata
        AssignedTo: digikam-devel kde org
        ReportedBy: lz europe com


Version:           0.9.0 (using KDE KDE 3.5.3)
Installed from:    Fedora RPMs
Compiler:          gcc 4.1.0
OS:                Linux

When displaying EXIF metadata (in the Metadata sidebar) with "User Comment" field in Unicode, Digikam crashes sporadically. When it doesn't crash, sometimes garbage characters are seen appended to the User Comment.

The crash happens in dmetadata.cpp, function convertCommentValue, line 1147:

return QString::fromUcs2((unsigned short *)comment.data());

It appears that comment.data() is not null-terminated, which causes QString::fromUcs2 to crash. I feel that the line above:

comment += "\0\0";

doesn't achieve its purpose. It may depend on the implementation of STL, but I think this code doesn't really do anything: the right-hand side is interpreted as null-terminated string, and thus is empty, so appending it has no effect. The following code:

comment.resize(comment.length()+2, 0);

does indeed append two null characters to comment, and this change eliminates the crash. Digikam developers, please consider making this change. I am attaching the patch. And thanks for the great application!
_______________________________________________
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 139766] Crash when displaying EXIF metadata with Unicode comment

Leonid Zeitlin
------- 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=139766         




------- Additional Comments From lz europe com  2007-01-08 11:38 -------
Created an attachment (id=19188)
 --> (http://bugs.kde.org/attachment.cgi?id=19188&action=view)
Proposed patch to fix the crash described in this report
_______________________________________________
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 139766] Crash when displaying EXIF metadata with Unicode comment

Gilles Caulier-2
In reply to this post by Leonid Zeitlin
------- 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=139766         




------- Additional Comments From caulier.gilles kdemail net  2007-01-08 11:59 -------
Marcel,

This is another Comments encoding stuff... What do you think about the patch ?

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 139766] Crash when displaying EXIF metadata with Unicode comment

Leonid Zeitlin
In reply to this post by Leonid Zeitlin
------- 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=139766         




------- Additional Comments From lz europe com  2007-01-21 12:54 -------
Hi Gilles, Marcel,
Just curious is the patch is going to be reviewed
_______________________________________________
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 139766] Crash when displaying EXIF metadata with Unicode comment

Marcel Wiesweg
In reply to this post by Leonid Zeitlin
------- 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=139766         
marcel.wiesweg gmx de changed:

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



------- Additional Comments From marcel.wiesweg gmx de  2007-01-22 15:31 -------
SVN commit 626219 by mwiesweg:

Apply patch from "lz europe com" (thanks for your help!):
Append terminating "\0\0" sequence to UCS2 string properly.
Adding with operator+= did nothing because it treats the sequence as a then empty C string.

BUG: 139766


 M  +2 -2      dmetadata.cpp  


--- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp #626218:626219
 @ -1146,8 +1146,8  @
         if (charset == "\"Unicode\"")
         {
             // QString expects a null-terminated UCS-2 string.
-            // Is it already null terminated? In any case, add termination for safety.
-            comment += "\0\0";
+            // Is it already null terminated? In any case, add termination "\0\0" for safety.
+            comment.resize(comment.length() + 2, '\0');
             return QString::fromUcs2((unsigned short *)comment.data());
         }
         else if (charset == "\"Jis\"")
_______________________________________________
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 139766] Crash when displaying EXIF metadata with Unicode comment

Leonid Zeitlin
In reply to this post by Leonid Zeitlin
------- 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=139766         




------- Additional Comments From lz europe com  2007-01-27 11:28 -------
Thanks a lot!
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel