Bug 397189 - digikam is crashing when adding this photo
Summary: digikam is crashing when adding this photo
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Engine (show other bugs)
Version: 5.9.0
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL: https://www.dropbox.com/s/v5b2qm2ne1o...
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-05 19:58 UTC by Pascal Megert
Modified: 2020-08-10 10:18 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Megert 2018-08-05 19:58:52 UTC
Hi

I've tried to add my extended photo collection to digikam. Unfortunately digikam was crashing all the time. So I tried to figure out the problem and to isolate one of the photos that crashes the software. The problem appears on MySQL and on SQLite database too. The attachment contains the photo.

Kind regards
Pascal
Comment 1 Pascal Megert 2018-08-05 20:04:28 UTC
The phot is bigger than 4000 KB. You can download it from my dropbox.
https://www.dropbox.com/s/v5b2qm2ne1odzo1/20160821035715.zip?dl=0
Comment 2 caulier.gilles 2018-08-05 20:18:31 UTC
Which camera is used to generate the photo ? Which software is used for post processing the photo before to include file in DK collection ?

Gilles Caulier
Comment 3 Maik Qualmann 2018-08-05 20:19:08 UTC
Here on Linux, there is only one message in the console without a crash:

digikam.metaengine: Can not load metadata from file (Error # 58: corrupted image metadata

Exiv2 says the file is broken. However, metadata can be displayed with exiftool. You best report the problem with the image example to the Exiv2 project. I can confirm the crash on Windows.

Maik
Comment 4 Maik Qualmann 2018-08-05 20:21:36 UTC
ExifTool Version Number         : 11.01
File Name                       : 20160821035715.jpg
Directory                       : .
File Size                       : 4.0 MB
File Modification Date/Time     : 2018:08:05 22:07:36+02:00
File Access Date/Time           : 2018:08:05 22:07:37+02:00
File Inode Change Date/Time     : 2018:08:05 22:07:36+02:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Big-endian (Motorola, MM)
Make                            : SAMSUNG
Camera Model Name               : SAMSUNG WB750
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : Microsoft Windows Photo Viewer 10.0.10586.0
Modify Date                     : 2016:08:21 03:57:15
Y Cb Cr Positioning             : Co-sited
Exposure Time                   : 1/500
F Number                        : 3.6
Exposure Program                : Program AE
ISO                             : 100
Exif Version                    : 0221
Date/Time Original              : 2016:08:21 03:57:15
Create Date                     : 2016:08:21 03:57:15
Components Configuration        : Y, Cb, Cr, -
Exposure Compensation           : 0
Max Aperture Value              : 3.7
Metering Mode                   : Multi-segment
Light Source                    : Unknown
Flash                           : No Flash
Focal Length                    : 6.8 mm
Maker Note Version              : 0100
Device Type                     : Compact Digital Camera
Samsung Model ID                : Various Models (0x5000000)
Smart Album Color               : Various; 157
Raw Data Byte Order             : Little-endian (Intel, II)
Raw Data CFA Pattern            : Swap
Warning                         : [minor] Bad offset for MakerNotes tag 0x0060
Face Detect                     : Off
Face Recognition                : On
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 3072
Exif Image Height               : 4096
Sensing Method                  : One-chip color area
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : 1
Focal Length In 35mm Format     : 41 mm
Scene Capture Type              : Standard
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
Offset Schema                   : 4180
Padding                         : (Binary data 2060 bytes, use -b option to extract)
Compression                     : JPEG (old-style)
Thumbnail Offset                : 24480
Thumbnail Length                : 5165
MPF Version                     : 0100
Number Of Images                : 2
MP Image Flags                  : Dependent child image
MP Image Format                 : JPEG
MP Image Type                   : Large Thumbnail (VGA equivalent)
MP Image Length                 : 55571
MP Image Start                  : 4194261
Dependent Image 1 Entry Number  : 640
Dependent Image 2 Entry Number  : 480
XMP Toolkit                     : Image::ExifTool 9.56
About                           : uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b
Date/Time Digitized             : 2016:08:21 03:57:15
Creator Tool                    : Microsoft Windows Photo Viewer 10.0.10586.0
Image Width                     : 3072
Image Height                    : 4096
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:0 (1 2)
Aperture                        : 3.6
Image Size                      : 3072x4096
Preview Image                   : (Binary data 55571 bytes, use -b option to extract)
Megapixels                      : 12.6
Scale Factor To 35 mm Equivalent: 6.0
Shutter Speed                   : 1/500
Thumbnail Image                 : (Binary data 5165 bytes, use -b option to extract)
Circle Of Confusion             : 0.005 mm
Field Of View                   : 47.4 deg
Focal Length                    : 6.8 mm (35 mm equivalent: 41.0 mm)
Hyperfocal Distance             : 2.58 m
Light Value                     : 12.7
maik@linux-tpgn:/daten/Bilder/Zugang/x/4> exiv2 20160821035715.jpg 
Exiv2 exception in print action for file 20160821035715.jpg:
corrupted image metadata
maik@linux-tpgn:/daten/Bilder/Zugang/x/4> exiftool 20160821035715.jpg 
ExifTool Version Number         : 11.01
File Name                       : 20160821035715.jpg
Directory                       : .
File Size                       : 4.0 MB
File Modification Date/Time     : 2018:08:05 22:07:36+02:00
File Access Date/Time           : 2018:08:05 22:07:37+02:00
File Inode Change Date/Time     : 2018:08:05 22:07:36+02:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Big-endian (Motorola, MM)
Make                            : SAMSUNG
Camera Model Name               : SAMSUNG WB750
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : Microsoft Windows Photo Viewer 10.0.10586.0
Modify Date                     : 2016:08:21 03:57:15
Y Cb Cr Positioning             : Co-sited
Exposure Time                   : 1/500
F Number                        : 3.6
Exposure Program                : Program AE
ISO                             : 100
Exif Version                    : 0221
Date/Time Original              : 2016:08:21 03:57:15
Create Date                     : 2016:08:21 03:57:15
Components Configuration        : Y, Cb, Cr, -
Exposure Compensation           : 0
Max Aperture Value              : 3.7
Metering Mode                   : Multi-segment
Light Source                    : Unknown
Flash                           : No Flash
Focal Length                    : 6.8 mm
Maker Note Version              : 0100
Device Type                     : Compact Digital Camera
Samsung Model ID                : Various Models (0x5000000)
Smart Album Color               : Various; 157
Raw Data Byte Order             : Little-endian (Intel, II)
Raw Data CFA Pattern            : Swap
Warning                         : [minor] Bad offset for MakerNotes tag 0x0060
Face Detect                     : Off
Face Recognition                : On
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 3072
Exif Image Height               : 4096
Sensing Method                  : One-chip color area
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : 1
Focal Length In 35mm Format     : 41 mm
Scene Capture Type              : Standard
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
Offset Schema                   : 4180
Padding                         : (Binary data 2060 bytes, use -b option to extract)
Compression                     : JPEG (old-style)
Thumbnail Offset                : 24480
Thumbnail Length                : 5165
MPF Version                     : 0100
Number Of Images                : 2
MP Image Flags                  : Dependent child image
MP Image Format                 : JPEG
MP Image Type                   : Large Thumbnail (VGA equivalent)
MP Image Length                 : 55571
MP Image Start                  : 4194261
Dependent Image 1 Entry Number  : 640
Dependent Image 2 Entry Number  : 480
XMP Toolkit                     : Image::ExifTool 9.56
About                           : uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b
Date/Time Digitized             : 2016:08:21 03:57:15
Creator Tool                    : Microsoft Windows Photo Viewer 10.0.10586.0
Image Width                     : 3072
Image Height                    : 4096
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:0 (1 2)
Aperture                        : 3.6
Image Size                      : 3072x4096
Preview Image                   : (Binary data 55571 bytes, use -b option to extract)
Megapixels                      : 12.6
Scale Factor To 35 mm Equivalent: 6.0
Shutter Speed                   : 1/500
Thumbnail Image                 : (Binary data 5165 bytes, use -b option to extract)
Circle Of Confusion             : 0.005 mm
Field Of View                   : 47.4 deg
Focal Length                    : 6.8 mm (35 mm equivalent: 41.0 mm)
Hyperfocal Distance             : 2.58 m
Light Value                     : 12.7


Windows Photo Viewer problem?

Software                        : Microsoft Windows Photo Viewer 10.0.10586.0

Maik
Comment 5 Pascal Megert 2018-08-05 21:16:20 UTC
Wow you guys are fast!

I did an additional test by removing the makernote because of the 
Warning : [minor] Bad offset for MakerNotes tag 0x0060 in the exiftool log

exiftool -makernotes= 20160821035715.jpg and it works with digikam!

I've no clue which software or probably hardware created the Makernote.
I guess it's an error in the Samsung Hardware.

Any comments from you?
Comment 6 caulier.gilles 2018-08-05 21:29:50 UTC
As Maik said, it's abnormal to see Exiv2 crashing with this kind of makernotes data.

You must report this problem as UPSTREAM to Exiv2 team for future fixes. We cannot fix it in digiKam as well. All low level metadata processing are done with this library.

Gilles Caulier
Comment 7 Maik Qualmann 2018-08-13 12:30:47 UTC
Gilles, we have a crash on Windows and not under Linux. Can it be possible that MinGW does not support the exceptions?

https://stackoverflow.com/questions/7244645/porting-vcs-try-except-exception-stack-overflow-to-mingw

Maik
Comment 8 caulier.gilles 2018-08-13 12:44:36 UTC
You want mean that MinGW do not support generic C++ exception ? Seriously ???

It's the base, i will be very surprised.

The C++ exception is generated by Exiv2. We catch all C++ exceptions from Exiv2 with Digikam::MetadaEngine wrapper. If none of one is catched by MinGW at run time, well digiKam will crash quickly, for ex while scanning collection at startup.

Does Exiv2 CLI tool crash under Windows with this kind of image ? If yes, well there is no C++ exception generated under Windows in this case (this can be different under Linux), and so it's a UPSTREAM bug.

Gilles
Comment 9 caulier.gilles 2018-08-28 19:13:17 UTC
The Windows installer have been recompiled with last changes from source code and is available here for testing :

https://files.kde.org/digikam/

Take a care : it's a beta release. Make a database backup before to test.

Gilles Caulier
Comment 10 caulier.gilles 2018-11-01 06:08:40 UTC
Git commit e49ba4368bbe6adbe0e0d5edef2802ceee7fbc9c by Human Dynamo.
Committed on 01/11/2018 at 06:04.
Pushed by cgilles into branch 'master'.

add new JPEG test image with load and patch tag path with DMetadata unit-test.

M  +11   -2    core/tests/metadataengine/applytagstest.cpp
M  +1    -1    core/tests/metadataengine/applytagstest.h
A  +-    --    core/tests/metadataengine/data/20160821035715.jpg

https://commits.kde.org/digikam/e49ba4368bbe6adbe0e0d5edef2802ceee7fbc9c
Comment 11 caulier.gilles 2018-11-01 06:55:40 UTC
Pascal,

Using Exiv2 0.27 under Linux, the unit test pass while read and write to your image.

Sure the JPG is corrupted but Exiv2 generate an exception and do not crash as expected.


[gilles@localhost metadataengine]$ ./applytagstest
********* Start testing of ApplyTagsTest *********
Config: Using QtTest library 5.9.4, Qt 5.9.4 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.4.0)
QDEBUG : ApplyTagsTest::initTestCase() Using Exiv2 Version: "0.27"
PASS   : ApplyTagsTest::initTestCase()
...
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() File to process: "/home/gilles/Documents/GIT/6.x/core/tests/metadataengine/data/20160821035715.jpg"
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() Temporary target file: "/tmp/digikam-applytagstest-21450/20160821035715.jpg"
QSYSTEM: ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: Cannot load metadata from file   (Error # 58 :  corrupted image metadata
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: Parse metadada with FFMpeg: "/tmp/digikam-applytagstest-21450/20160821035715.jpg"
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: -- FFMpeg video stream metadata entries :
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: QMap()
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: -----------------------------------------
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: -- FFMpeg root container metadata entries :
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: QMap()
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: ------------------------------------------
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: xmlACDSee "<Categories><Category Assigned=\"1\">test</Category></Categories>"
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: "/tmp/digikam-applytagstest-21450/20160821035715.jpg"  ==> New Iptc Keywords:  ("test")
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: MetaEngine::metadataWritingMode 0
QDEBUG : ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: Will write Metadata to file "/tmp/digikam-applytagstest-21450/20160821035715.jpg"
QSYSTEM: ApplyTagsTest::testApplyTagsToMetadata() digikam.metaengine: Cannot save metadata using Exiv2   (Error # 58 :  corrupted image metadata
PASS   : ApplyTagsTest::testApplyTagsToMetadata()
PASS   : ApplyTagsTest::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 71ms
********* Finished testing of ApplyTagsTest *********


So i think your problem is solved with Exiv2 0.27. We use this lib version now with current digiKam 6.0.0 beta installer. So i recommend to make a try with this DK release.

https://files.kde.org/digikam/

Warning : compared to DK 5.9.0, the 6.0.0 use new database tables to store similarity fingerprints. o the Database files will migrate to new schema and using back DK 5.9.0 will not be possible. So please make a database backup before to use this DK beta.

Gilles Caulier
Comment 12 caulier.gilles 2019-03-09 08:36:58 UTC
Pascal,

The problem still reproducible using current 6.1.0 pre-release installer for
Windows available here :

https://files.kde.org/digikam/

Thanks in advance

Gilles Caulier
Comment 13 Maik Qualmann 2019-03-14 20:50:03 UTC
The crash under Windows with the image from the comment 1 is no longer reproducible. I close the bug.

Maik