Executive brief
libsixel is a library used to encode and decode images into the SIXEL format, often used for displaying graphics in terminal emulators. A security flaw in how the library handles animated GIF files allows a specially crafted image to cause the software to crash or potentially execute unauthorized code. This occurs when the library incorrectly manages memory while processing multiple frames of an animation, leading to a situation where the application tries to use memory that has already been cleared.
Technical details
A use-after-free vulnerability exists in the load_gif() function within fromgif.c of libsixel. The root cause is that a single sixel_frame_t object is reused for all frames of an animated GIF, and the gif_init_frame() function unconditionally frees and reallocates the frame->pixels buffer between frames without checking the object's reference count. If an application uses the documented sixel_frame_ref() and sixel_frame_get_pixels() APIs within a callback, it will be left with a dangling pointer once the second frame is decoded. An attacker can exploit this by providing a crafted animated GIF to an application using sixel_helper_load_image_file() with a multi-frame callback. This issue is fixed in version 1.8.7-r1.
Affected products
- saitoha libsixel <= 1.8.7
Timeline
- 2026-04-14: disclosed
- 2026-04-14: patched: Fixed in version 1.8.7-r1
- 2026-04-14: advisory