After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 455481 - Metadata plug-in does not escape special characters
Metadata plug-in does not escape special characters
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
git master
Other All
: Normal normal
: ---
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2007-07-10 09:42 UTC by John Marshall
Modified: 2007-08-29 19:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to escape special characters in xmp_encode.c (2.58 KB, patch)
2007-07-10 09:44 UTC, John Marshall
none Details | Review
JPEG file with escaped characters in xmp block (22.08 KB, image/jpeg)
2007-08-16 12:22 UTC, John Marshall
  Details

Description John Marshall 2007-07-10 09:42:38 UTC
Please describe the problem:
When saving the XMP data block in the metadata plugin special characters such as < > are not escaped causing a badly formed XMP block to be saved in the jpeg file.

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 John Marshall 2007-07-10 09:44:14 UTC
Created attachment 91532 [details] [review]
Patch to escape special characters in xmp_encode.c
Comment 2 Sven Neumann 2007-07-10 09:50:57 UTC
g_markup_escape_text() allocates memory that needs to be freed using g_free(). As far as I can see your patch leaks that memory.
Comment 3 Raphaël Quinet 2007-07-10 11:01:23 UTC
I don't think that it is the right place to escape the special characters, because this should be done already when the XMP data is read and copied into the internal data structures.  I just saw that it is not done when you use the PDB calls, but I would rather try to fix it there rather than in xmp_encode.c because doing it at this stage is basically too late already.  I will try to fix this as soon as possible.

Just out of curiosity, how did you get these special characters in the XMP block?
Comment 4 John Marshall 2007-07-10 18:55:38 UTC
I had an oldish test file with <Creator> in the IPTC creator field.  This at some point had been updated into the XMP block. Opening this and then saving led to unescaped characters in the save file.  I only noticed from the error messages when re-opening the file.
Comment 5 Raphaël Quinet 2007-07-30 23:04:02 UTC
(In reply to comment #4)
> I had an oldish test file with <Creator> in the IPTC creator field.  This at
> some point had been updated into the XMP block.

It would be nice if you could attach that test file (or its XMP block) to this bug report so that I can check if the solution that I would like to apply will work with your file.
Comment 6 John Marshall 2007-08-16 12:19:42 UTC
Sorry about the delay, I've been on holiday.  Attached belowia a jpeg file with the correctly escaped characters < and > symbols in the xmp packet.  Saving as a new jpeg exhibits the problem.
Comment 7 John Marshall 2007-08-16 12:22:03 UTC
Created attachment 93777 [details]
JPEG file with escaped characters in xmp block
Comment 8 Raphaël Quinet 2007-08-29 19:38:24 UTC
Thanks for the test file.  After analyzing this problem a bit, I changed my mind and decided to escape the characters in the output as you initially suggested.  I had to rewrite the patch because the result of g_markup_escape_text() must be freed, but the basic idea is the same.

2007-08-29  Raphaël Quinet  <raphael@gimp.org>

	* plug-ins/metadata/xmp-encode.c (gen_property): escape the text
	values output in the XMP packet.  Based on a bug report and patch
	by John Marshall.  Fixes bug #455481.

There is still an issue with this test file because the flash settings are not parsed and saved correctly, but that's for another bug report...