google / wuffs

Wrangling Untrusted File Formats Safely
Other
4.06k stars 129 forks source link

Decode TGA #67

Closed richgel999 closed 2 years ago

richgel999 commented 2 years ago

Hi, Could you support the Truevision TGA format? It's still quite popular with game developers, and supports 24bpp/32bpp images. It's quite simple to parse for the most part, although it's complex enough that security concerns are still relevant.

https://en.wikipedia.org/wiki/Truevision_TGA

Test files: https://github.com/image-rs/image/tree/master/tests/images/tga/testsuite

Thanks.

nigeltao commented 2 years ago

I'm marking this is as fixed because, AFAICT, Wuffs now correctly decodes the *.tga files in https://github.com/image-rs/image/tree/master/tests/images/tga/testsuite that you mentioned, as well as e.g. those from https://github.com/timfel/tombexcavator/tree/master/data/TGA

There may still be some bug fixes and performance improvments to come, as always.

I'm not sure if I decode "16 bits per pixel, with transparency" correctly. The 1991 era spec's not super-clear exactly when to treat it as BGRX5551 vs BGRA5551. More importantly, I don't have any real world *.tga files to exercise that, so I'd only be guessing if I'd got it right.

Please file new bugs if you have *.tga files that Wuffs doesn't decode correctly.

nigeltao commented 2 years ago

(Actually marking this issue as fixed/closed.)