syoyo/tinygltf

[Enhancement] Use wuffs/fpng for reading/writing images with better security and performance

syoyo opened this issue · 2 comments

syoyo commented

Describe the issue

TinyGLTF currently uses stb_image, stb_image_write for reading/writing images.
STB library is easy to use and embed, but has some security issues and slow to decode/encode(especially PNG)

are good alternative for reading/writing images with security/performance considered.

Support matrix

  • JPEG decoding: wuffs
  • JPEG encoding: No support in wuffs. We still need stb_image_write to encode JPEG
  • PNG decoding: wuffs or fpng
  • PNG encodng: fpng

Expected behaviour

Add support to use wuffs and fpng(for PNG) for better security and performance.
We also need a compile flag to disable using SIMD instrinsic for portability.

syoyo commented

wuffs jpeg decoder has been implemented: https://github.com/google/wuffs/blob/main/doc/std/image-decoders.md

Use wuffs-unsupported-snapshot.c for a while: https://github.com/google/wuffs/blob/main/release/c/wuffs-unsupported-snapshot.c
(v0.3 does not support JPEG decoding)