Bug #1347

Segfault in Digikam when saving/loading certain TIFF images

Added by V Engmark 6 months ago. Updated 22 days ago.

Status:AssignedStart date:29 Apr 2018
Priority:NormalDue date:
Assignee:Robin Mills% Done:

100%

Category:insufficient informationEstimated time:2.00 hours
Target version:0.27

Description

Already reported at <https://bugs.kde.org/show_bug.cgi?id=393635&gt;, I was told to report it here as well.

_MG_5144_v1.TIFF - Example image crashing Digikam (13.4 MB) V Engmark, 22 Sep 2018 09:41

exiv2-0.27-clang-scan-build-report.tar.lzma - clang scan-build HTML reports (168 KB) Gilles Caulier, 23 Sep 2018 09:24

exiv2-0.27-cppcheck-report.tar.lzma - cppcheck HTML reports (430 KB) Gilles Caulier, 23 Sep 2018 09:35

History

#2 Updated by Robin Mills 6 months ago

  • Category set to tiff parser
  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Priority changed from High to Normal
  • Target version set to 0.27

Can you attach the test image, please?

#4 Updated by Robin Mills 5 months ago

Apologies for the delay in dealing with this. I hosted the Exiv2 Developer's Meeting at my home last weekend and been very busy with other Exiv2 matters.

I don't have an account with transfernow.net Can you attach the files to this issue, please?

#5 Updated by Robin Mills 27 days ago

  • Category changed from tiff parser to insufficient information
  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100
  • Estimated time set to 1.00

#6 Updated by V Engmark 23 days ago

#7 Updated by Robin Mills 23 days ago

  • Category changed from insufficient information to tiff parser
  • Status changed from Closed to Assigned
  • % Done changed from 100 to 20
  • Estimated time changed from 1.00 to 2.00

Thanks for the file. I've reopened the case.

#8 Updated by Robin Mills 23 days ago

  • Category changed from tiff parser to insufficient information
  • Status changed from Assigned to Closed

Regrettably, your file doesn't give me anything to investigate. Neither Exiv2 v0.26 nor the current 'master' (which will release as v0.27 later in 2018) exhibit problems with your file.

539 rmills@rmillsmbp:~/gnu/exiv2/v0.26 $ exiv2 -pa ~/Downloads/_MG_5144_v1.TIFF | wc
Warning: Directory Image3, entry 0x0111: Strip 0 is outside of the data area; ignored.
     238   30271  296580
540 rmills@rmillsmbp:~/gnu/exiv2/v0.26 $ cd ../../github/exiv2/exiv2/build
541 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/build $ bin/exiv2 -pa ~/Downloads/_MG_5144_v1.TIFF | wc
Warning: Directory Image3, entry 0x0111: Strip 0 is outside of the data area; ignored.
     238   30271  296580
542 rmills@rmillsmbp:~/gnu/github/exiv2/exiv2/build $ 
I'm happy to work to resolve your issue when we have a definition that can be reproduced with the command-line program exiv2. I'm unable to investigate any issue which can only be produced using digiKam.

#9 Updated by Robin Mills 23 days ago

  • % Done changed from 20 to 100

#10 Updated by V Engmark 23 days ago

The Digikam people insist it's an Exiv2 problem - please see https://bugs.kde.org/show_bug.cgi?id=393635#c16

#11 Updated by Robin Mills 23 days ago

Please ask the DigiKam Engineers to reproduce your issue with the eviv2 command-line program and your issue will be investigated.

#12 Updated by Robin Mills 22 days ago

I've read digicam's bug report and I see it's in printStructure(). A great deal of work has been done for v0.27 concerning printStructure() and I'm confident that this issue has been resolved. I'm on vacation this week, however I'm hoping to releasee Exiv2 v0.27 RC1 when I return home in early October. I recommend that dikiKam build with Exiv2 v0.27 RC1 and verify that this issue has been resolved.

#13 Updated by Gilles Caulier 22 days ago

If the Exiv2 code from git/master is enough stable, i can start to embed this Exiv2 0.27 pre-version in the digiKam bundles (AppImage for Linux, PKG for MacOS, and MXE for windows).

To clarify your ideas and viewpoints about the Exiv2 use-case in DK : Exiv2 API are used in a Qt wrapper which is used multi-threaded everywhere. This point is very important, as trying to reproduce a bug in Exiv2 CLI tool cannot be enough to validate a report as a bug.

All the Exiv2 API must be re-entrant and must support multi-core (we dont not use mutex in this wrapper for the moment). Multi-threading is the way to use this king of library to process metadata in the background without to block the GUI. This permit also to speed-up process using all computer core, and not only one.

In DK, we use multi-core everywhere : database queries, image processing, file management, and of course metadata. DK play with metadata only through Exiv2. This can be around the file from disk, but also in memory though byte-array, for exemple to prepare the registration of photo informations in database.

And of course, there is a famous point of XMP SDK from Adobe. We have a copy inside DK core to build the DNG SDK from Adobe in goal to convert RAW file to DNG. All source code from Adobe are bad quality, as i can see through the reports from static analyzer. So, i'm sure that re-entrancy is not respected everywhere with XMP SDK (it's easy to see, with source code and the way to implement some classes).

So you must considerate the XMP SDK as a critical section in Exiv2. You must take a care.

This is imply to have few test units in Exiv2 which test the re-entrancy of all API with a complete collection of images. Re-using the exist test to run in separated thread can be a solution.

The DK users base is very important, especially since the Windows version become better and better (thanks to MXE cross-compilation). We can provide an alpha version of Exiv2 in the pre-release bundles published weekly. We will receive quickly a feedback about the code stability.

Gilles Caulier

#14 Updated by Gilles Caulier 22 days ago

Another point very import : in digiKam bundle, e disable few option that don't use or considerate as very instable :

https://cgit.kde.org/digikam.git/tree/project/bundles/3rdparty/ext_exiv2/CMakeLists.txt

For exemple, the video support in Exiv2 crash digiKam in few seconds. We use ffmpeg metadata parser instead in digiKam.

Gilles Caulier

#15 Updated by Gilles Caulier 22 days ago

Exiv2 0.27 git code parsed with clang scan-build static analyzer.

Enjoy the XMP SDK source code...

Gilles Caulier

#16 Updated by Gilles Caulier 22 days ago

Note about clang scan-build report : it compile files and parse at the same time. So, only compiled files are checked.

I use this script to configure Exiv2 :

https://cgit.kde.org/digikam.git/tree/project/scripts/bootstrap-exiv2.sh

So take a care, not all Exiv2 code are compiled in this report, as it's the configuration used for digiKam...

Gilles Caulier

#17 Updated by Gilles Caulier 22 days ago

Exiv2 0.27 git code parsed with cppcheck static analyzer.

Note : no code are compiled here and all source code are parsed as well...

Gilles Caulier

#18 Updated by Robin Mills 22 days ago

  • Status changed from Closed to Assigned

Thank You, Gilles, for all this valuable feedback. I hope you're good and recovered from your accident.

Your observations about multi-threading are valid. Perhaps we should be give multi-threading more consideration in v0.28. I'm glad to let you know that I have a couple of very good engineers working with me on Exiv2 and they have undertaken most of the work for v0.27. I've been hoping to retire from Exiv2 and perhaps I really will retire in another year or two!

The primary goal of v0.27 has been to fix lots of security flaws which have been reported during the last 12 months. I hope to publish RC1 in early October and aiming for GM in December. Exiv2 v0.27 will have "long term support" and "dot releases" (exiv2 v0.27.1 , v0.27.2 etc) will have security features added in parallel to the development of v0.28.

I believe one of your DK colleagues discussed printStructure() with me last year. Here's my reply. http://dev.exiv2.org/boards/3/topics/3080?r=3081#message-3081

I'm on vacation at the moment. I'll have to find time to review your various contributions and decide how to proceed. If you have specific changes you want in Exiv2 v0.27 RC1, I recommend that your report an issue (preferably as a PR) to http://github.com/exiv2/exiv2 and Dan or Luis (my wonderful team mates) may accept and integrate your suggestions.

I am very pleased that you are interested in integrating Exiv2 v0.27 RC1 into digiKam. During the 6 month review period for Exiv2 v0.26, I don't recall anybody reporting anything concerning any release candidate. No matter how much testing Team Exiv2 performs, there are execution paths which are unique to applications such as digiKam. Your feedback is valuable and appreciated.

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux