3 ms·
If you want to be super-paranoid, only accept BMP or TGA with a specific color depth and no compression and validate the header before parsing. Or even accept
by Dylan16807 11y ago
If you want to be super-paranoid, only accept BMP or TGA with a specific color depth and no compression and validate the header before parsing. Or even accept only raw RGB data, 3 * width * height, and require the size be passed separately.
Then convert it to png yourself.
You can't prevent exploits from all angles, but you can prevent exploits from some angles.