Project

General

Profile

RE: Empty elements in a rdf:Seq » crash.cc

C++ test that crashes on crash.xmp in toString() - Tobias E., 15 Mar 2014 07:14

 
1
// g++ -W -Wall -g `pkg-config --cflags --libs exiv2` -o crash crash.cc
2
#include <exiv2/easyaccess.hpp>
3
#include <exiv2/xmp.hpp>
4
#include <exiv2/error.hpp>
5
#include <exiv2/image.hpp>
6
#include <exiv2/exif.hpp>
7

    
8
#include <stdio.h>
9

    
10
int main()
11
{
12
  Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open("crash.xmp");
13
  if(image.get() == 0) return 0;
14

    
15
  image->readMetadata();
16

    
17
  Exiv2::XmpData                 &xmpData = image->xmpData();
18
  Exiv2::XmpData::const_iterator  pos     = xmpData.findKey(Exiv2::XmpKey("Xmp.darktable.multi_name"));
19
  if(pos != xmpData.end())
20
    printf("found %ld entries, should be 4\nelement 3: `%s'\n", pos->count(), pos->toString(3).c_str());
21
  else
22
    printf("not found\n");
23
  return 1;
24
}
(2-2/2)