Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exiv2 0.27 : CR2 and Exif data extraction crash to ExifParser::encode() #496

Closed
cgilles opened this issue Oct 27, 2018 · 8 comments
Closed

Comments

@cgilles
Copy link
Collaborator

cgilles commented Oct 27, 2018

(gdb) r
Starting program: /usr/bin/exiv2 -e e ./IMG_2520.CR2
Missing separate debuginfos, use: debuginfo-install glibc-2.22-29.mga6.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Warning: Exif tag Exif.Photo.MakerNote not encoded
Warning: Exif tag Exif.Canon.0x4005 not encoded

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff797bde2 in Exiv2::ExifParser::encode(std::vector<unsigned char, std::allocator >&, unsigned char const*, unsigned int, Exiv2::ByteOrder, Exiv2::ExifData const&) () from /usr/bin/../lib64/libexiv2.so.0
Missing separate debuginfos, use: debuginfo-install lib64expat1-2.2.1-1.mga6.x86_64 lib64zlib1-1.2.11-4.1.mga6.x86_64 libgcc1-5.5.0-1.mga6.x86_64 libstdc++6-5.5.0-1.mga6.x86_64
(gdb) bt
#0 0x00007ffff797bde2 in Exiv2::ExifParser::encode(std::vector<unsigned char, std::allocator >&, unsigned char const*, unsigned int, Exiv2::ByteOrder, Exiv2::ExifData const&) () from /usr/bin/../lib64/libexiv2.so.0
#1 0x00007ffff79a9e89 in Exiv2::JpegBase::doWriteMetadata(Exiv2::BasicIo&) () from /usr/bin/../lib64/libexiv2.so.0
#2 0x00007ffff79a8cda in Exiv2::JpegBase::writeMetadata() () from /usr/bin/../lib64/libexiv2.so.0
#3 0x000000000042e96c in (anonymous namespace)::metacopy(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, int, bool) ()
#4 0x00000000004277b2 in Action::Extract::run(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) ()
#5 0x0000000000412b4e in main ()
(gdb)

CR2 file to test is here :

https://cgit.kde.org/digikam.git/tree/core/tests/metadataengine/data/IMG_2520.CR2

Original report from digiKam :

https://bugs.kde.org/show_bug.cgi?id=400140

Gilles Caulier

@cgilles
Copy link
Collaborator Author

cgilles commented Oct 27, 2018

Simple unit test code to reproduce the crash with Exiv2 API. Pass the CR2 file path as argument

extract_exif.cpp.txt

@cgilles
Copy link
Collaborator Author

cgilles commented Oct 27, 2018

Ok, i investiguated better and found this :

1/ i updated Exiv2 to official RC1 code and now the Exiv2 CLI tool and the simple unit test do not crash. The simple unit test still crashing while it compiled into digiKam.

2/ The RC1 install libexiv2 binary with a new typo :
[gilles@localhost lib64]$ pwd
/usr/lib64
[gilles@localhost lib64]$ ls -al exiv2
lrwxrwxrwx 1 root root 16 oct. 27 09:45 libexiv2lib.so -> libexiv2lib.so.0*
lrwxrwxrwx 1 root root 23 oct. 27 09:45 libexiv2lib.so.0 -> libexiv2lib.so.0.27.0.1*
-rwxr-xr-x 1 root root 4586080 oct. 27 09:41 libexiv2lib.so.0.27.0.1*
lrwxrwxrwx 1 root root 18 oct. 26 2017 libexiv2.so.26 -> libexiv2.so.26.0.0*
-rwxr-xr-x 1 root root 3209280 oct. 26 2017 libexiv2.so.26.0.0*
[gilles@localhost lib64]$

Why this extra "lib" at end of so fiel name. Look like 0.26 do not use this scheme (and this sound generic with other libraries under Linux)

On my system i found that a previous version of libexiv2.so version 0.27 was present (3 weeks ago), using the old typo. So with the FindExiv2.cmake script from digiKam, the older one was used instead the new one. This explain why simple unit test crash inside digiKam and not exiv2.

I fixed the cmake detection script and now the right file was used to link digiKam.

https://cgit.kde.org/digikam.git/commit/?id=87e5ee6503f084b4bd9c8e1b1311a76655c2685e

So the pending question is about the extra "lib" suffix on .so file name.

Gilles Caulier

@clanmills
Copy link
Collaborator

The exiv2lib.dll is courtesy of CMake!

In src/CMakeLists.txt, we had:

set_target_properties(exiv2lib PROPERTIES NAME exiv2 VERSION...)

This caused friction with the executable exiv2.

@cgilles
Copy link
Collaborator Author

cgilles commented Oct 27, 2018

There is no need of extra lib, even of CLI tool is name exiv2.
Typically "libexiv2" and "exiv2" binaries must be installed. There is no conflict at install time.
So if the problem is with internal cmake rules of the project, i'm sure that all can be fixed easily. The new naming scheme is only used by Exiv2. I cannot see other shared libraries under linux using the same.
This will certainly confuse client applications side.

@cgilles
Copy link
Collaborator Author

cgilles commented Oct 27, 2018

My last comment is just a tip. You can close this file now as my original problem is solved and my find cmake script is patched.

@clanmills
Copy link
Collaborator

If you want the lib changed, please submit a PR. And please update all the documentation (in releasenotes/platform/ReadMe.txt), the website and the test harness.

@clanmills
Copy link
Collaborator

@cgilles Luis has opened an issue report about the filename of the library. We'll fix it for exiv2 v0.27RC2 (mid-November). #498

@cgilles
Copy link
Collaborator Author

cgilles commented Oct 27, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants