DrKLO/Telegram · critical
GIF input is unsupported for legal reasons. Sorry.
Error message
GIF input is unsupported for legal reasons. Sorry.
What it means
The jinit_read_gif function in rdgif.c is a stub that always prints this message and calls exit(EXIT_FAILURE). Although GIF_SUPPORTED is a compile-time macro, the function body contains no actual GIF decoding logic -- it is intentionally disabled for legal/licensing reasons (GIF uses LZW compression, which was historically patent-encumbered). Any attempt to read a GIF file through the cjpeg input pipeline triggers this hard exit.
Source
Thrown at TMessagesProj/jni/mozjpeg/rdgif.c:34
*
* We are required to state that
* "The Graphics Interchange Format(c) is the Copyright property of
* CompuServe Incorporated. GIF(sm) is a Service Mark property of
* CompuServe Incorporated."
*/
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
#ifdef GIF_SUPPORTED
/*
* The module selection routine for GIF format input.
*/
GLOBAL(cjpeg_source_ptr)
jinit_read_gif(j_compress_ptr cinfo)
{
fprintf(stderr, "GIF input is unsupported for legal reasons. Sorry.\n");
exit(EXIT_FAILURE);
return NULL; /* keep compiler happy */
}
#endif /* GIF_SUPPORTED */
View on GitHub (pinned to 45ab8f4308)
Solutions
- Convert GIF images to an intermediate format (PNG, BMP, PPM) using an external tool (ImageMagick, giflib) before feeding them to cjpeg.
- Do not enable GIF_SUPPORTED in the build configuration unless a real GIF reader implementation is provided.
- If GIF input is needed, patch rdgif.c to use a real GIF decoding library (e.g., giflib) instead of the stub.
Example fix
# before cjpeg input.gif > output.jpg # after convert input.gif input.png cjpeg input.png > output.jpg
Defensive patterns
Strategy: validation
Validate before calling
# Check file type before passing to cjpeg
if file "$input" | grep -qi gif; then
convert "$input" "${input%.*}.png"
input="${input%.*}.png"
fi
cjpeg "$input" > output.jpg Prevention
- Check the input file format with the file command before passing to cjpeg.
- Pre-convert GIF files to PNG or PPM using ImageMagick or giflib.
- Avoid defining GIF_SUPPORTED in the build unless a real reader is linked.
When it happens
Trigger: Calling jinit_read_gif() (selected as the cjpeg input module when the input file is detected as GIF), or running cjpeg on a .gif file when this mozjpeg build compiles with GIF_SUPPORTED defined but without a real GIF reader implementation.
Common situations: A build configuration that defines GIF_SUPPORTED without linking a real GIF library; attempting to convert GIF images to JPEG using cjpeg from this mozjpeg fork; automated image processing pipelines that feed GIF files into the JPEG encoder.
Related errors
- %s: sorry, arithmetic coding not supported
- %s: missing argument for dct
- %s: invalid argument for dct
- %s: missing argument for dc-scan-opt
- %s: sorry, entropy optimization was not compiled in
AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14).
Data as JSON: /api/errors/5a132b7af10eadae.
Report an issue: GitHub.