A memory disclosure and segmentation fault issue exists when the software re-saves images as TIFF files using the libtiff encoder. The problem occurs in the `PyImaging LibTiffEncoderNew()` function within `src/encode.c` because the encoder does not correctly verify if the Python value being passed to the variadic `TIFFSetField()` function matches the field definition expected by libtiff.
An attacker can provide a crafted TIFF file containing specific tags that trigger this mismatch. For example, if a tag is defined by libtiff as a counted array but is passed as a scalar, libtiff may interpret the scalar value as a byte count and copy an arbitrary amount of process memory from a stale pointer into the output file. Alternatively, if a tag is defined as a fixed-size array, the scalar value may be used as a source memory address, leading to a process crash (SIGSEGV).
Technical details include:
- **Vulnerable Function**: `PyImaging LibTiffEncoderNew()`
- **Vulnerable Parameters**: Crafted TIFF tags such as `DNGPrivateData` (50740) and `ActiveArea` (50829).
- **Impact**: This can lead to a complete ASLR bypass by leaking pointers from ` imaging.so`, libpython, libc, and libtiff, or cause a denial of service via process crashes.