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

XMP file crashes darktable, segmentation fault #14241

Closed
mbelow opened this issue Apr 17, 2023 · 9 comments · Fixed by #14253
Closed

XMP file crashes darktable, segmentation fault #14241

mbelow opened this issue Apr 17, 2023 · 9 comments · Fixed by #14253
Assignees
Labels
bug: pending someone needs to start working on that priority: high core features are broken and not usable at all, software crashes reproduce: confirmed a way to make the bug re-appear 99% of times has been found scope: image processing correcting pixels understood: incomplete devs lack some important info to start fixing
Milestone

Comments

@mbelow
Copy link

mbelow commented Apr 17, 2023

Describe the bug

I imported a collection of about 400 Fuji X-E4 RAW images (.RAF). I was able to go through all images for a first cull. Then I wanted to edit the remaining images. When I reached about half of the remaining collection darktable crashed each time while generating previews in the lightroom view. On the command line, I get “Speicherzugriffsfehler darktable” (memory access error/segmentation fault).

I tried running darktable with the -d cache and -d all arguments without clear results. Then I tried to rebuild the cache with darktable-generate-cache. It crashed as well, the last line in the -d all output was:

image 7311/7818 (93,51%) (id:7312, file=DSCF8970.RAF)

Removing the RAF file and the
corresponding XMP has fixed my problem. I am able to re-import the RAF
file into a separate collection and use it without issues. But when I
import the RAF file with the XMP file into another separate collection
darktable crashes again.

Darktable should take more care in handling its input data. If data (in
the XMP file?) is broken, darktable should discard the invalid input
data. Anyhow, no kind of input data should lead darktable to a
segmentation fault ("Speicherzugriffsfehler").

Steps to reproduce

  1. Open darktable
  2. Import RAF file from a directory containing also the XMP

Expected behavior

Darktable should handle errors in input data robustly, without crashing. Bad data should be discarded. At no time should bad input data lead to a segmentation fault.

Logfile | Screenshot | Screencast

<?xml version="1.0" encoding="UTF-8"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
    xmlns:exif="http://ns.adobe.com/exif/1.0/"
    xmlns:xmp="http://ns.adobe.com/xap/1.0/"
    xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
    xmlns:darktable="http://darktable.sf.net/"
   exif:DateTimeOriginal="2023:04:09 07:44:01.000"
   xmp:Rating="1"
   xmpMM:DerivedFrom="DSCF8970.RAF"
   darktable:import_timestamp="63817353117472532"
   darktable:xmp_version="5"
   darktable:raw_params="0"
   darktable:auto_presets_applied="1"
   darktable:history_end="10"
   darktable:iop_order_version="2"
   darktable:history_auto_hash="02daaf1ff566f0d9ce34201c86c8ce7d"
   darktable:history_current_hash="02daaf1ff566f0d9ce34201c86c8ce7d">
   <darktable:masks_history>
    <rdf:Seq/>
   </darktable:masks_history>
   <darktable:history>
    <rdf:Seq>
     <rdf:li
      darktable:num="0"
      darktable:operation="rawprepare"
      darktable:enabled="1"
      darktable:modversion="2"
      darktable:params="000000000c0000008400000006000000ff03ff03ff03ff03ff3f000000000000"
      darktable:multi_name=""
      darktable:multi_priority="0"
      darktable:blendop_version="11"
      darktable:blendop_params="gz14eJxjYIAACQYYOOHEgAZY0QVwggZ7CB6pfNoAAE8gGQg="/>
     <rdf:li
      darktable:num="1"
      darktable:operation="demosaic"
      darktable:enabled="1"
      darktable:modversion="4"
      darktable:params="0000000000000000000000000104000001000000cdcc4c3e"
      darktable:multi_name=""
      darktable:multi_priority="0"
      darktable:blendop_version="11"
      darktable:blendop_params="gz14eJxjYIAACQYYOOHEgAZY0QVwggZ7CB6pfNoAAE8gGQg="/>
     <rdf:li
      darktable:num="2"
      darktable:operation="colorin"
      darktable:enabled="1"
      darktable:modversion="7"
      darktable:params="gz48eJzjZhgFowABWAbaAaNgwAEAOQAAEA=="
      darktable:multi_name=""
      darktable:multi_priority="0"
      darktable:blendop_version="11"
      darktable:blendop_params="gz14eJxjYIAACQYYOOHEgAZY0QVwggZ7CB6pfNoAAE8gGQg="/>
     <rdf:li
      darktable:num="3"
      darktable:operation="colorout"
      darktable:enabled="1"
      darktable:modversion="5"
      darktable:params="gz35eJxjZBgFo4CBAQAEEAAC"
      darktable:multi_name=""
      darktable:multi_priority="0"
      darktable:blendop_version="11"
      darktable:blendop_params="gz14eJxjYIAACQYYOOHEgAZY0QVwggZ7CB6pfNoAAE8gGQg="/>
     <rdf:li
      darktable:num="4"
      darktable:operation="gamma"
      darktable:enabled="1"
      darktable:modversion="1"
      darktable:params="0000000000000000"
      darktable:multi_name=""
      darktable:multi_priority="0"
      darktable:blendop_version="11"
      darktable:blendop_params="gz14eJxjYIAACQYYOOHEgAZY0QVwggZ7CB6pfNoAAE8gGQg="/>
     <rdf:li
      darktable:num="5"
      darktable:operation="temperature"
      darktable:enabled="1"
      darktable:modversion="3"
      darktable:params="fb74fd3f0000803f757dfa3f0000c07f"
      darktable:multi_name=""
      darktable:multi_priority="0"
      darktable:blendop_version="11"
      darktable:blendop_params="gz14eJxjYIAACQYYOOHEgAZY0QVwggZ7CB6pfNoAAE8gGQg="/>
     <rdf:li
      darktable:num="6"
      darktable:operation="highlights"
      darktable:enabled="1"
      darktable:modversion="4"
      darktable:params="050000000000803f00000000000000000000803f000000000100000005000000cdcccc3e000000400000000000000000"
      darktable:multi_name=""
      darktable:multi_priority="0"
      darktable:blendop_version="11"
      darktable:blendop_params="gz13eJxjYGBgYARiCQYYOOHEgAZY0QVwggZ7CB6pfNoAAFDAGQk="/>
     <rdf:li
      darktable:num="7"
      darktable:operation="filmicrgb"
      darktable:enabled="1"
      darktable:modversion="6"
      darktable:params="gz02eJybNXOyo3zr+wOmcbMcGMDAAUifcIJgCJgFVKO/rMIGJNZXHOnAdV0ZyG6wh8mfPeNjxwykQZgRKsaIxIYBJigNABTUEr0="
      darktable:multi_name=""
      darktable:multi_priority="0"
      darktable:blendop_version="11"
      darktable:blendop_params="gz10eJxjYGBgYAFiCQYYOOHEgAZY0QVwggZ7CB6pfOygYtaVAyCMi08IAAB/xiOk"/>
     <rdf:li
      darktable:num="8"
      darktable:operation="exposure"
      darktable:enabled="1"
      darktable:modversion="6"
      darktable:params="00000000000080b93333333f00004842000080c001000000"
      darktable:multi_name=""
      darktable:multi_priority="0"
      darktable:blendop_version="11"
      darktable:blendop_params="gz10eJxjYGBgYAFiCQYYOOHEgAZY0QVwggZ7CB6pfOygYtaVAyCMi08IAAB/xiOk"/>
     <rdf:li
      darktable:num="9"
      darktable:operation="flip"
      darktable:enabled="1"
      darktable:modversion="2"
      darktable:params="ffffffff"
      darktable:multi_name=""
      darktable:multi_priority="0"
      darktable:blendop_version="11"
      darktable:blendop_params="gz14eJxjYIAACQYYOOHEgAZY0QVwggZ7CB6pfNoAAE8gGQg="/>
    </rdf:Seq>
   </darktable:history>
  </rdf:Description>
 </rdf:RDF>
</x:xmpmeta>

Commit

No response

Where did you install darktable from?

distro packaging

darktable version

4.2.1

What OS are you using?

Linux

What is the version of your OS?

Debian testing

Describe your system?

Lenovo Thinkpad L13, 16 GB RAM, i7-10510U CPU, CometLake-U GT2 graphics

Are you using OpenCL GPU in darktable?

None

If yes, what is the GPU card and driver?

No response

Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip

The relevant picture is a family picture (egg hunt), so I don't want to put it into the bug tracker, If necessary I can send it to individual developers upon request.

@jenshannoschwalm
Copy link
Collaborator

If you want someone here to analyse that file you'd have to share it. Some files are just broken :-)

Or you use exiv2 first to see for something obvious

@TurboGit
Copy link
Member

rdf:Seq/
</darktable:masks_history>
darktable:history
rdf:Seq

This chunk of XMP is broken.

@jenshannoschwalm
Copy link
Collaborator

This chunk of XMP is broken.

I didn't touch that code part yet, Any idea why/how that would happen? Or could we do some xmp validation?

@TurboGit
Copy link
Member

I think the broken XMP is because the OP has not properly cut&paste it here or what I think is that the XML tag have been broken by GitHub rendering.

@TurboGit
Copy link
Member

I have checked (I have the permission to edit the original post) and putting the XMP inside a code block fixes the XMP.

@TurboGit
Copy link
Member

But I have been able to load the XMP without issue now. So cannot reproduce the issue on my side with current master.

@mbelow
Copy link
Author

mbelow commented Apr 18, 2023

Thank you for the quick reply! I sent the image to TurboGit, exiv2 does not show any issues:
File name : DSCF8970.RAF
File size : 58216768 Bytes
MIME type : image/x-fuji-raf
Image size : 4416 x 2944
Thumbnail : image/jpeg, 8744 Bytes
Camera make : FUJIFILM
Camera model : X-E4
Image timestamp : 2023:04:09 07:44:01
File number :
Exposure time : 1/900 s
Aperture : F4
Exposure bias : -33/100 EV
Flash : No flash
Flash bias :
Focal length : 90.0 mm
Subject distance:
ISO speed : 1250
Exposure mode : Auto
Metering mode : Multi-segment
Macro mode :
Image quality : NORMAL
White balance : Auto
Copyright :
Exif comment :

@TurboGit
Copy link
Member

I had a look and it seems that the rotation and perspective module has buggy values. Maybe a crash while editing?

image

I'm not sure how this has happened, but to fix edit your XMP and replace:

darktable:history_end="11"
by
darktable:history_end="10"

To skip the last history (rotation and perspective).

From there you can compress the history and you'll be ok.

It would be good to avoid the crash on dt side of course.

TurboGit added a commit to TurboGit/darktable that referenced this issue Apr 19, 2023
TurboGit added a commit to TurboGit/darktable that referenced this issue Apr 19, 2023
@TurboGit TurboGit added this to the 4.4 milestone Apr 19, 2023
@TurboGit TurboGit added priority: high core features are broken and not usable at all, software crashes understood: incomplete devs lack some important info to start fixing reproduce: confirmed a way to make the bug re-appear 99% of times has been found scope: image processing correcting pixels bug: pending someone needs to start working on that labels Apr 19, 2023
@TurboGit TurboGit self-assigned this Apr 19, 2023
@mbelow
Copy link
Author

mbelow commented Apr 19, 2023 via email

TurboGit added a commit to TurboGit/darktable that referenced this issue Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: pending someone needs to start working on that priority: high core features are broken and not usable at all, software crashes reproduce: confirmed a way to make the bug re-appear 99% of times has been found scope: image processing correcting pixels understood: incomplete devs lack some important info to start fixing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants