Bug #1322

Exception in PentaxMakerNote::printShutterCount, source: pentaxmn.cpp

Added by Norbert Wagner about 1 month ago. Updated about 1 month ago.

Status:ClosedStart date:03 Oct 2017
Priority:NormalDue date:
Assignee:Robin Mills% Done:

100%

Category:metadataEstimated time:1.00 hour
Target version:v0.26.1

Description

I modified the exifprint, replacing i->value() with i->print(). In general works fine, but with images from Pentax K5 it runs into an exception when calling PentaxMakerNote::printShutterCount.

I compiled the project with Microsoft Visual Studio Community 2015

Here the code block with my modification:
Exiv2::ExifData::const_iterator end = exifData.end();
for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
const char* tn = i->typeName();
std::cout << std::setw(44) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< (tn ? tn : "Unknown") << " "
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
// replace << std::dec << i->value()
<< std::dec << i->print()
// end of change
<< "\n";
}

Pentax-K5.jpg (80.4 KB) Norbert Wagner, 03 Oct 2017 18:59

History

#1 Updated by Robin Mills about 1 month ago

  • Category set to metadata
  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Target version set to v0.26.1

Thanks for reporting this. I'm on vacation at the moment and I've gone down with a (medical) virus. I'll try to investigate this soon. If I forget, you are welcome to "ping" me by asking for an update on this issue in a couple of weeks.

#2 Updated by Robin Mills about 1 month ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100
  • Estimated time set to 1.00

Good News. This is a known issue and fixed on master. It's #1305

The fix is in pentaxmn.cpp #1170:

    std::ostream& PentaxMakerNote::printShutterCount(std::ostream& os, const Value& value, const ExifData* metadata)
    {
        if (!metadata) return os << "undefined";

        ExifData::const_iterator dateIt = metadata->findKey(
                ExifKey("Exif.PentaxDng.Date"));
        ....
When I apply the fix, here's the output:
C:\Users\rmills\gnu\exiv2\0.26\msvc\bin\win32\release>exifprint.exe ..\..\..\Pentax-K5.jpg | grep -i shut
Exif.Pentax.ShutterCount                     0x005d Undefined   4  undefined

C:\Users\rmills\gnu\exiv2\0.26\msvc\bin\win32\release>

#3 Updated by Norbert Wagner about 1 month ago

thanks for the fast response, is working now.

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux