nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
26.31k stars 7.69k forks source link

Fix reading bmp V3 info headers with `BI_BITFIELDS` compression #1450

Open Cirras opened 1 year ago

Cirras commented 1 year ago

Previously these bitmaps would unconditionally discard all 4 bitmasks, then erroneously overread another 12 bytes if the compression was BI_BITFIELDS.

See attached BMP with BITMAPV3INFOHEADER and BI_BITFIELDS compression. It should be loaded properly by paint, and currently cause a "bad BMP" error in stb_image. v3_info_header_with_bitfields.zip

Cirras commented 7 months ago

Totally understand that the maintainers have their own priorities, but I'd really appreciate it if this one could be looked at and hopefully merged. It would allow me to remove some gnarly hacks in a LibGDX application that (indirectly) relies on sbt for loading bitmaps.