Modifying EXIF changes untouched attributes
Modification of EXIF can in some situations cause mutations in untouched attributes. This even occurs in several operations done during the unittests, specifically test_add_shorts
, test_add_shorts_and_srational_le
and test_modify
. The attributes that unintendedly got changed are Compoents Configuration and Subject Area.
This can easily seen by running exiftool on the original image, and image written at the end of the test case.
Before test_add_shorts
Components Configuration : Y, Cb, Cr, -
Subject Area : 2015 1511 2217 1330
After:
Components Configuration : Y, Cb, Cr, Err (24)
Subject Area : 0 51839 0 5475
These issues are caused by an incomplete implementation of value_fits_in_ifd_tag
. Some attributes, such as Component Configuration
of type UNDEFINED
are considered as reference and are thus incremented when new data blocks are inserted. Other attributes, such as Subject Area
, which are SHORT
arrays of 4 elements are considered as value and are therefore not incremented, although the position of the referenced data in the file changes.
I'll prepare a merge request.