saitoha / libsixel

A SIXEL encoder/decoder implementation derived from kmiya's sixel (https://github.com/saitoha/sixel).
MIT License
2.45k stars 82 forks source link

[BUG] a reachable assert in stbi__create_png_image_raw #163

Open kdsjZh opened 2 years ago

kdsjZh commented 2 years ago

Describe the bug There is a reachable assert bug found in stbi__create_png_image_raw, can be triggered via img2sixel+ ASan

To Reproduce compile the program with CFLAGS="-fsanitize=address" CC=clang then run ./img2sixel $POC output:

img2sixel: ./stb_image.h:4374: int stbi__create_png_image_raw(stbi__png *, stbi_uc *, stbi__uint32, int, stbi__uint32, stbi__uint32, int, int): Assertion `img_width_bytes <= x' failed.
Aborted

system ubuntu 16.04, clang 12.0.1 libsixel latest commit 6a5be8b72d84037b83a5ea838e17bcf372ab1d5f

Credit Han Zheng NCNIPC of China Hexhive

POC poc.zip