Bug 633619 - libexiv2.so.6.0.0 core dumps when EXIF count=0, at value.hpp:1549 <- exif.cpp:407
libexiv2.so.6.0.0 core dumps when EXIF count=0, at value.hpp:1549 <- exif.cpp...
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: exiv2 (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Rex Dieter
Fedora Extras Quality Assurance
: MoveUpstream
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-13 23:05 EDT by Tim Taiwanese Liim
Modified: 2012-08-16 18:13 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-16 18:13:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
the bad photo causing libexiv2 to core; it has an "Orientation" entry with item count=0. (3.81 MB, image/jpeg)
2010-09-13 23:05 EDT, Tim Taiwanese Liim
no flags Details

  None (edit)
Description Tim Taiwanese Liim 2010-09-13 23:05:25 EDT
Created attachment 447112 [details]
the bad photo causing libexiv2 to core; it has an "Orientation" entry with item count=0.

Description of problem:
    libexiv2 should be able to handle problematic photos without core
    dumping.  The attached sample photo is screwed up by some photo
    editors (I am not sure which one), so 
      - In good photos:
        1 occurence of "Exif.Image.Orientation"
          count_ = 1, offset_ = 65536, size_ = 2
      - in the attached bad photo:
        3 occurence of "Exif.Image.Orientation"
          count_ = 0, offset_ = 0, size_ = 0
          count_ = 1, offset_ = 65536, size_ = 2
          count_ = 1, offset_ = 65536, size_ = 2

    In the bad case, when hugin tries to get "Exif.Image.Orientation",
    libexiv2 uses the first occurence whose count = 0; when trying to get
    return value_[n] (n=0), libexiv2 core dumps, because value_[] has 0
    length.

    Admitted the photo is bad, but libexiv2 should be able to discard bad
    EXIF entries without core dumping.  A possibility is to check
    object->count() before adding entry into exitData_:
        TiffDecoder::decodeStdTiffEntry() {
            ExifKey key(object->tag(), tiffGroupName(object->group()));
            key.setIdx(object->idx());
            // ************************************************************
            if (object->count() == 0) {
                std::cerr << "skip empty EXIF item " << key.key() << std::endl;
                return;
            }
            // ************************************************************
            exifData_.add(key, object->pValue());
        }

    But this is just a wild guess; you know better how to fix this
    issue properly.  Thanks.

Version-Release number of selected component (if applicable):
    exiv2-libs-0.19-1.fc13.x86_64

How reproducible:
    always, with the attached bad photo.
    never, with usual good photos.


Steps to Reproduce:
    1. start hugin (hugin uses libexiv2)
    2. in "Assistant" tab, click "1. Load Images..."
    3. select "DSC_6224.bad.JPG" (see the attached file).

Actual results:
    hugin core dumps, inside /usr/lib64/libexiv2.so.6.0.0, with stack
    trace [1].

Expected results:
    photo loaded without core dump, just like any other photos.


Additional info:

  [1] stack trace
      #0 Exiv2::ValueType<unsigned short>::toLong (this=0x1b92880, n=0) at
         value.hpp:1549
      #1 Exiv2::Exifdatum::toLong (this=0x1b86850, n=0) at exif.cpp:407
      #2 HuginBase::SrcPanoImage::getExiv2Value (this=0x7fffffffb920,
         exifData=..., keyName="Exif.Image.Orientation", value=@0x7fffffffb3e8)
         at .../hugin-2010.0.0/src/hugin_base/panodata/SrcPanoImage.cpp:746
      #3 HuginBase::SrcPanoImage::readEXIF (this=0x7fffffffb920,
         focalLength=@0x7fffffffbe00, cropFactor= @0x7fffffffbe08,
         eV=@0x7fffffffb6f8, applyEXIFValues=true, applyExposureValue=true) at
         .../hugin-2010.0.0/src/hugin_base/panodata/SrcPanoImage.cpp:420
      ...

  [2] The value of "this" in #0 of [1]; with n=0, "return value_[n];"
      results in core dump, because value_ has length 0.
        (gdb) p *this
        $1 = {<Exiv2::Value> = {_vptr.Value = 0x7ffff6ed6270, ok_ = true,
        type_ = Exiv2::unsignedShort}, value_ = std::vector of length 0,
        capacity 0, pDataArea_ = 0x0, sizeDataArea_ = 0}
Comment 1 Bug Zapper 2011-05-31 09:34:51 EDT
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 2 Tim Taiwanese Liim 2011-06-05 22:59:26 EDT
This same core dump issue is present in exiv2-libs-0.21.1-1.fc14.x86_64.
Changed Version to F14.
Comment 3 Rex Dieter 2011-06-06 13:07:40 EDT
Sorry for the delay, I'll try to send this upstream,
http://dev.exiv2.org/projects/exiv2/issues
sometime this week.  (unless someone else beats me to it).
Comment 4 Tim Taiwanese Liim 2011-06-08 16:44:25 EDT
Rex, thanks!
Comment 5 Fedora End Of Life 2012-08-16 18:13:30 EDT
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

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