Bug 232785 - jhead inserts to the images metadata random non-printable characters
Summary: jhead inserts to the images metadata random non-printable characters
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: jhead
Version: 6
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Adrian Reber
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-03-17 19:31 UTC by Matěj Cepl
Modified: 2018-04-11 08:22 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2007-03-22 19:51:29 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
image with corrupted metadata (1.67 MB, image/jpeg)
2007-03-17 19:31 UTC, Matěj Cepl
no flags Details
script mentioned in the comment (515 bytes, application/octet-stream)
2007-03-17 19:50 UTC, Matěj Cepl
no flags Details
another example of corrupted image (2.33 MB, image/jpeg)
2007-03-20 19:23 UTC, Matěj Cepl
no flags Details

Description Matěj Cepl 2007-03-17 19:31:52 UTC
Description of problem:
[matej@chelcicky 18]$ jhead -dc p20041118_132838.jpg 
[matej@chelcicky 18]$ jhead p20041118_132838.jpg 
File name    : p20041118_132838.jpg
File size    : 1754224 bytes
File date    : 2004:11:18 13:28:38
Camera make  : SONY
Camera model : DSC-P73
Date/Time    : 2004:11:18 13:28:38
Resolution   : 1728 x 2304
Flash used   : Yes (auto, return light detected)
Focal length :  6.0mm
Exposure time: 0.025 s  (1/40)
Aperture     : f/2.8
ISO equiv.   : 100
Whitebalance : Auto
Metering Mode: matrix
Exposure     : program (auto)
Comment      : 

(the last character in comment, if it is not preserved in bugzilla, is chr(2))

The character is not only chr(2), but also chr(1), chr(7), "d", and other
characters. The operation which corrupts metadata is not only -dc but different
operations with the image do it as well.

Version-Release number of selected component (if applicable):
jhead-2.6-3.fc6

How reproducible:
from my sample of 1700+ images, I get corrupted some couple of hundred of them.
Tried many times to remove garbage characters (jhead -cl seems to not introduce
anything else, so attached script works for me) and always got couple of hundred
corrupted image files.

Steps to Reproduce:
see above or do other operations on the images with jhead.

Actual results:
by using jhead on my images random characters are introduced to the images metadata.

Expected results:
jhead should not take its own initiative about the content of my metadata

Comment 1 Matěj Cepl 2007-03-17 19:31:54 UTC
Created attachment 150318 [details]
image with corrupted metadata

Comment 2 Matěj Cepl 2007-03-17 19:50:59 UTC
Created attachment 150320 [details]
script mentioned in the comment

Comment 3 Matěj Cepl 2007-03-19 17:59:40 UTC
Still reproducible with jhead-2.7-1.fc6

Comment 4 Adrian Reber 2007-03-19 18:11:51 UTC
I thought that the new release will probably not help but I tried it... just in
case. I will try to get in contact with upstream to see if they have any idea
what might be wrong here.

Comment 5 Adrian Reber 2007-03-19 21:43:19 UTC
Following question from the author:

Well, there's nonprintable characters in the exif comment.
I guess I should filter those out if present.
Where did this image come from?  Just curious how that comment got inserted.
Also curious what the best strategy should be in terms of dealing with that
kind of corruption.

And:

I'll work on something to clean this up.  Just more of a question where the
image came from so I get a better sense of what else I might expect.

Its specific to the image and whatever tool processed it at any rate, so its
not a major issue.



You can either directly contact the author or just let me know here and I
forward it.

Comment 6 Matěj Cepl 2007-03-20 19:23:40 UTC
Created attachment 150521 [details]
another example of corrupted image

One more attempt to get rid of the non-printable characters.

[matej@chelcicky 18]$ jhead p20041118_132838.jpg 
File name    : p20041118_132838.jpg
File size    : 1754224 bytes
File date    : 2004:11:18 13:28:38
Camera make  : SONY
Camera model : DSC-P73
Date/Time    : 2004:11:18 13:28:38
Resolution   : 1728 x 2304
Flash used   : Yes (auto, return light detected)
Focal length :	6.0mm
Exposure time: 0.025 s	(1/40)
Aperture     : f/2.8
ISO equiv.   : 100
Whitebalance : Auto
Metering Mode: matrix
Exposure     : program (auto)
Comment      : 

[matej@chelcicky 18]$ jhead -cl "" p20041118_132838.jpg 
Comment not modified
[matej@chelcicky 18]$ jhead p20041118_132838.jpg 
File name    : p20041118_132838.jpg
File size    : 1754224 bytes
File date    : 2004:11:18 13:28:38
Camera make  : SONY
Camera model : DSC-P73
Date/Time    : 2004:11:18 13:28:38
Resolution   : 1728 x 2304
Flash used   : Yes (auto, return light detected)
Focal length :	6.0mm
Exposure time: 0.025 s	(1/40)
Aperture     : f/2.8
ISO equiv.   : 100
Whitebalance : Auto
Metering Mode: matrix
Exposure     : program (auto)
Comment      : 

[matej@chelcicky 18]$ exiftran -c "" p20041118_132838.jpg 
you have to either specify a output file (-o <file>)
or enable inplace editing (-i). Try -h for more info.
[matej@chelcicky 18]$ exiftran -c "" -i p20041118_132838.jpg 
processing p20041118_132838.jpg
[matej@chelcicky 18]$ jhead p20041118_132838.jpg 
File name    : p20041118_132838.jpg
File size    : 1754247 bytes
File date    : 2007:03:20 19:44:18
Camera make  : SONY
Camera model : DSC-P73
Date/Time    : 2004:11:18 13:28:38
Resolution   : 1728 x 2304
Flash used   : Yes (auto, return light detected)
Focal length :	6.0mm
Exposure time: 0.025 s	(1/40)
Aperture     : f/2.8
ISO equiv.   : 100
Whitebalance : Auto
Metering Mode: matrix
Exposure     : program (auto)
Comment      : ?

[matej@chelcicky 18]$ jhead -cl "" p20041118_132838.jpg 
Comment not modified
[matej@chelcicky 18]$ 

Otherwise, to upstream maintainer's questions (are we talking about Matthias
Wandel? Shouldn't we added him to Cc: of this bug?):

1) I don't think it is matter of one image -- I have hundreds of images with
comments like this (see above). This one is originally from my camera (Sony
Cybershot DSC-P73) and went through a lot of programs -- for the longest time
it was imported from the camera and then managed with digikam, then for the
brief time I tried f-spot, but now I switched to jbrout, which uses jhead and
exiftran internally for all its image processing (and I am applying for review
in Fedora Extras -- Adrian, wouldn't you be so kind and make review of bug
230316? :-)) I am almost certain, that these characters were not present in the
file until it was touched by jbrout (and thus by jhead), but I couldn't prove
it. I am 100% sure, that it was OK in digikam, I tried f-spot so briefly
(Novell just then announced deal with Microsoft so I got rid of all Mono-based
apps then) that I am not sure. I could try, but I don't have any idea how to
triage it.

2) How to deal with these characters? I don't know. Well, first of all, it
would be useful to find out how (and whether) either jhead or exiftran really
corrupt metadata and fix it ;-). However, concerning the already corrupted
files, I am not sure -- I could certainly make some script to delete all one
character comments (if jhead actually worked). See this another attached image
-- comment here is only letter "d", so even filtering on non-printable
characters (although it would be quite useful) wouldn't help. BTW, this image
was created with another camera and nothing else than gthum-import, exiftrans
(possibly) and jhead haven't touched it.

Comment 7 Adrian Reber 2007-03-22 19:51:29 UTC
Please contact Matthias Wandel because I cannot help you here. He does not want
to create yet another account to have bugzilla access. I have received another
mail from him:

I'm not sure if its wise to fix.

What if the strings are in UTF8?  In that case, I shouldn't discard
"nonprintable" characters, should I?

Maybe its best to close this as a non-bug

Grep also outputs nonprintable characters if the source data has
nonprintable characters.



I am closing the bug with UPSTREAM because that is the only way it can be
resolved. Sorry cannot help you here.


Note You need to log in before you can comment on or make changes to this bug.