An update:
I changed the code to read: TIFFSetField(m_tiff, EXIFTAG_CFAPATTERN, count, reinterpret_cast<uint8_t *>(&cfaDimPat)); Which appears to have fixed the problem though I'm unclear why it would change anything much . D. From: Tiff <[email protected]> On Behalf Of David C. Partridge via Tiff Sent: 22 June 2025 06:17 To: [email protected] Subject: [Tiff] Problem with SIGSEGV on Linux with TIFFSetField for EXIFTAG_CFAPATTERN I have the following code: // // Now write EXIFTAG_CFAPATTERN which is basically what we put into cfaDimPat // when the other (non-EXIF) CFA related tags were written. // if (cfa) { constexpr uint16_t count = sizeof(cfaDimPat.dim) + sizeof(cfaDimPat.cfa.cfa4); TIFFSetField(m_tiff, EXIFTAG_CFAPATTERN, count, cfaDimPat); } Which works just fine on Windows. However, on Linux I get a SIGSEGV and my signal handler prints a backtrace as follows: 00002431 2025-06-22 04:43:00.002 005575 7f8a2f604100 >In signalHandler(SIGSEGV) 00002432 2025-06-22 04:43:00.064 005575 7f8a2f604100 >__GI___sigaction at :? 00002432 2025-06-22 04:43:00.064 005575 7f8a2f604100 > 00002433 2025-06-22 04:43:00.110 005575 7f8a2f604100 >__memcpy_avx_unaligned_erms at ./string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:399 00002433 2025-06-22 04:43:00.110 005575 7f8a2f604100 > 00002434 2025-06-22 04:43:00.147 005575 7f8a2f604100 >_TIFFVSetField at tif_dir.c:? 00002434 2025-06-22 04:43:00.147 005575 7f8a2f604100 > 00002435 2025-06-22 04:43:00.186 005575 7f8a2f604100 >TIFFSetField at ??:? 00002435 2025-06-22 04:43:00.186 005575 7f8a2f604100 > 00002436 2025-06-22 04:43:00.743 005575 7f8a2f604100 >CTIFFWriter::Open() at /home/amonra/.vs/DSS/DeepSkyStackerKernel/TIFFUtil.cpp:1077 Where line 1077 is the TIFFSetField call above. tif_dirinfo.c says this about that tag: {EXIFTAG_CFAPATTERN, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "CFAPattern", NULL} Have I got the type for the count value incorrect or got that value wrong (should I provide the count of uint16_t values rather than count of bytes)? The cfaDimPat structure is defined as follows: struct { uint16_t dim[2]{ 0 }; union { uint8_t cfa4[4]; uint8_t cfa9[9]; uint8_t cfa16[16]; } cfa { 0 }; } cfaDimPat; Thank you, David
_______________________________________________ Tiff mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/tiff
