CVE-2023-52356: added proper validation and boundary checks to prevent
the SEGV and potential heap-buffer overflow
CVE-2023-52355: added functionality to set a maximum possible allocation size
in bytes in order to prevent out-of-memory issues when opening a TIFF file and
added memory limit option in tools