Project

General

Profile

Bug #1324

Pentax Makernote written twice

Added by Dominique Nerriec about 4 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
makernote
Target version:
Start date:
19 Nov 2017
Due date:
% Done:

100%

Estimated time:
1.00 h

Description

Bug found with JPG files from Pentax K-3.
Sample attached : IMKT1330.JPG

How to reproduce ?
Execute an "exiv2 -M" command that triggers an "intrusive writting". Example :

exiv2  -M"set Exif.Image.Software mon logiciel a moi coucou coucou coucou" IMKT1330.JPG

We see that Pentax Makernote fields are written twice :

exiv2 -p a IMKT1330.JPG |sort|uniq -d

And if we try a second "intrusive writting", it fails :


Files

IMKT1330.JPG (323 KB) IMKT1330.JPG Dominique Nerriec, 19 Nov 2017 20:38

History

#1

Updated by Dominique Nerriec about 4 years ago

...And if we try a second "intrusive writting", it fails :

$ exiv2 -M"del Exif.Image.Software" IMKT1330.JPG 
Warning: Exif tag Exif.PentaxDng.0x0406 not encoded
Warning: Exif tag Exif.PentaxDng.0x0406 not encoded
Exiv2 exception in modify action for file IMKT1330.JPG:
Taille du segment JPEG Exif est plus grand que 65535 octets

What happens ?
It seems that there is a mix up between 'PentaxDng' group and 'Pentax' group.
In exif written in JPG by exiv2, there is a 0xC634 tag, which should be written only in DNG file.

Why was it ok with previous Camera ?
For example in K7 files, the Pentax header signature was "AOC" in JPG, and "PENTAX" in DNG.
But in K3, signature is "PENTAX" for both.

----+-----------+---------
    |    DNG    |    JPG
----+-----------+---------
K7  |  PENTAX   |    AOC
----+-----------+---------
K3  |  PENTAX   |  PENTAX
----+-----------+---------

Where is the bug ?
exiv2 relies on that header to choose between pentaxDngId and pentaxId.
This is in makernote.cpp newPentaxMn().

Here is a suggestion to fix. It worked for me (fixed the issue for JPG files, no regression on DNG files)

       if (   size > 8
            && std::string(reinterpret_cast<const char*>(pData), 8) == std::string("PENTAX \0", 8)) {
            // Require at least the header and an IFD with 1 entry
            if (size < PentaxDngMnHeader::sizeOfSignature() + 18) return 0;
// my change BEGIN            
          //return newPentaxDngMn2(tag, group, pentaxDngId);
            return newPentaxDngMn2(tag, group, (tag == 0xc634 ? pentaxDngId:pentaxId)) 
// my change END

I'm using 0.25-3.1 release.
Last July, I downloaded sources from trunk, the bug was the same.

I downloaded samples of other Pentax cameras. It seems that the bug is the same for K70.

I hope that will help... thanks in advance to fix that in official product.

#2

Updated by Robin Mills about 4 years ago

  • Category set to makernote
  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Target version set to 0.27
  • % Done changed from 0 to 10
  • Estimated time set to 2.00 h

We've both tried to update this issue. I see you've given me more information. I'll look at this on Monday.

Here's what I was going to say:Dominique:

I can't reproduce this behaviour.

517 rmills@rmillsmbp:~/Downloads $ !curl
curl -O http://dev.exiv2.org/attachments/download/1200/IMKT1330.JPG
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  322k    0  322k    0     0   405k      0 --:--:-- --:--:-- --:--:--  407k
518 rmills@rmillsmbp:~/Downloads $ exiv2 -pa --grep Software IMKT1330.JPG 
Exif.Image.Software                          Ascii      24  PENTAX K-3 Ver. 1.30   
519 rmills@rmillsmbp:~/Downloads $ exiv2  -M"set Exif.Image.Software another software that goes on and on and on you know" IMKT1330.JPG
520 rmills@rmillsmbp:~/Downloads $ exiv2 -pa --grep Software IMKT1330.JPG 
Exif.Image.Software                          Ascii      53  another software that goes on and on and on you know
521 rmills@rmillsmbp:~/Downloads $ 
I can't reproduce this with your command arguments.
506 rmills@rmillsmbp:~/Downloads $ curl -O http://dev.exiv2.org/attachments/download/1200/IMKT1330.JPG
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  322k    0  322k    0     0   296k      0 --:--:--  0:00:01 --:--:--  342k
507 rmills@rmillsmbp:~/Downloads $ exiv2  -M"set Exif.Image.Software mon logiciel a moi coucou coucou coucou" IMKT1330.JPG
508 rmills@rmillsmbp:~/Downloads $ exiv2  -M"set Exif.Image.Software mon logiciel a moi coucou coucou coucou" IMKT1330.JPG
509 rmills@rmillsmbp:~/Downloads $ exiv2  -M"set Exif.Image.Software mon logiciel a moi coucou coucou coucou" IMKT1330.JPG
510 rmills@rmillsmbp:~/Downloads $ exiv2 -pa --grep Software IMKT1330.JPG 
Exif.Image.Software                          Ascii      40  mon logiciel a moi coucou coucou coucou
511 rmills@rmillsmbp:~/Downloads $ <pre>

#3

Updated by Dominique Nerriec about 4 years ago

Hello,
thanks for working on that issue.

Only Makernote is written twice.
I should give such example in my description :

$ exiv2 -pa IMKT1330.JPG |grep AELock
Exif.PentaxDng.AELock                        Short       1  Off
$ exiv2 -M"set Exif.Image.Software mon logiciel a moi coucou coucou coucou" IMKT1330.JPG
$ exiv2 -pa IMKT1330.JPG |grep AELock
Exif.PentaxDng.AELock                        Short       1  Off
Exif.PentaxDng.AELock                        Short       1  Off
$

And the second modification fails only if it also triggers "intrusive writting" :
$ exiv2 -M"set Exif.Image.Software mon logiciel a moi coucou coucou coucou" IMKT1330.JPG
$ exiv2 -M"set Exif.Image.Software mon logiciel a moi coucou coucou coucou" IMKT1330.JPG
$ exiv2 -M"set Exif.Image.Software mon logiciel a moi coucou coucou coucou longer" IMKT1330.JPG
Warning: Exif tag Exif.PentaxDng.0x0406 not encoded
Warning: Exif tag Exif.PentaxDng.0x0406 not encoded
Exiv2 exception in modify action for file IMKT1330.JPG:
Size of Exif JPEG segment is larger than 65535 bytes
$
#4

Updated by Dominique Nerriec about 4 years ago

(in my comments a few minutes ago, I used exiv2-0.26-trunk.tar.gz)

#5

Updated by Robin Mills almost 4 years ago

  • Estimated time changed from 2.00 h to 4.00 h

Dominique:

I have only had 30 minutes today to look at this. I'm not going to have time until Monday December 4 to investigate this further. Alison and I live in England and will fly tomorrow to Vietnam to attend the wedding of a member of Team Exiv2. I'm not going to be able to look at this until I'm home (and recovered from the journey).

I'm not sure what's going on here, however this issue seems to have been in the code for years. So while I understand your concern, I don't feel this is urgent. You can report the issue on http://github.com/exiv2/exiv2 (and reference this issue report). Another team member may take on the challenge. However, I would prefer that you wait for my return. We hope to reach Exiv2 v0.27 RC1 in December and I would like the team to retain focus on their current tasks.

#6

Updated by Dominique Nerriec almost 4 years ago

thanks Robin, I agree it is not urgent. Have a good journey !

#7

Updated by Robin Mills about 3 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 10 to 100
  • Estimated time changed from 4.00 h to 1.00 h

Discussion of this issue will continue on https://github.com/Exiv2/exiv2/issues/533

I am closing this issue on Redmine in preparation for Exiv2 v0.27 (expected 2018-12-31) when Redmine will become read-only.

Also available in: Atom PDF