Added minimal support for tiff encoder parameters and test for issue #2161
Fix rollover when computing buffer size in tiff decoder (bug #2161)