Setting an XMP seq to the empty list segfaults
Bug #510393 reported by
Olivier Tilloy
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pyexiv2 |
Fix Released
|
Medium
|
Olivier Tilloy |
Bug Description
This happens with pyexiv2 0.2 (development branch) compiled against libexiv2 0.19.
After setting the value of an XMP tag of type 'seq ProperName' to the empty list [], writing back the metadata raises a segmentation fault. Test script to reproduce:
import pyexiv2
m = pyexiv2.
m.read()
m['Xmp.dc.creator'] = pyexiv2.
m.write()
I am not sure whether emptying a seq is valid anyway, this needs to be investigated.
Related branches
Changed in pyexiv2: | |
status: | Confirmed → Fix Released |
status: | Fix Released → Fix Committed |
Changed in pyexiv2: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
The following minimal C++ program reproduces the issue:
#include "exiv2/image.hpp" :Image: :AutoPtr image = Exiv2:: ImageFactory: :open(argv[ 1]); >readMetadata( ); >xmpData( )["Xmp. dc.creator" ].setValue( 0); >writeMetadata( );
int main(int argc, char** argv)
{
Exiv2:
image-
image-
image-
return 0;
}
(to be compiled with `g++ -lexiv2`)
When run with the path to an image file as parameter, here is the output:
terminate called after throwing an instance of 'Exiv2: :BasicError< char>'
what(): Value not set
libexiv2 doesn't accept empty values, which makes sense. To prevent this from happening, pyexiv2 could raise an exception when setting an array (seq, bag, alt) value to the empty list.