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

lz at europe.com lz at europe.com
Mon Jan 8 10:37:35 GMT 2007


------- 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!



More information about the Digikam-devel mailing list