Skip to content

Commit

Permalink
Allow out of spec DateTimeOriginal without trailing null byte
Browse files Browse the repository at this point in the history
  • Loading branch information
victoryforce authored and TurboGit committed Jan 6, 2025
1 parent cde6169 commit 3796bff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/common/exif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1138,9 +1138,12 @@ static void _find_datetime_taken(Exiv2::ExifData &exifData,
// Note: We allow a longer "datetime original" field with an unnecessary
// trailing byte(s) due to buggy software that creates it.
// See https://github.com/darktable-org/darktable/issues/17389
// We also accept the out of spec Exif.Photo.DateTimeOriginal
// without a null terminator, which AnalogExif creates.
// See https://github.com/darktable-org/darktable/issues/18146
if((FIND_EXIF_TAG("Exif.Image.DateTimeOriginal")
|| FIND_EXIF_TAG("Exif.Photo.DateTimeOriginal"))
&& pos->size() >= DT_DATETIME_EXIF_LENGTH)
&& pos->size() >= DT_DATETIME_EXIF_LENGTH - 1)
{
_strlcpy_to_utf8(exif_datetime_taken, DT_DATETIME_EXIF_LENGTH, pos, exifData);
if(FIND_EXIF_TAG("Exif.Photo.SubSecTimeOriginal")
Expand Down

0 comments on commit 3796bff

Please sign in to comment.