2020.12.11 15:22 "[Tiff] SIGSEGV within TIFFGetField()", by OnlineCop

2020.12.11 18:30 "Re: [Tiff] SIGSEGV within TIFFGetField()", by Paavo

LibTIFF has a braindead interface where it is not possible to read arbitrary field values according to their type even though the type is encoded clearly in the TIFF file. Instead, you have to know exactly how to call TIFFGetField() for each standard tag. But that does not work for custom tags. For a custom tag you have to call TIFFGetField() with 4 arguments:

                           std::uint32_t value_count = 0; 
                           void* raw_data = nullptr; 
                           if(TIFFGetField(tif, tiffTag, &value_count, &raw_data)==1) {

and interpret the result according to TIFFField info:


              const TIFFField *fip = ... 
              if(fip->field_type == ::TIFF_ASCII) { 
                     std::string result(static_cast<const char*>(raw_data), value_count);


HTH

Paavo