Heap Buffer Overflow in Stable Diffusion C++ Library by Leejet
CVE-2026-47749
What is CVE-2026-47749?
The stable-diffusion.cpp library, utilized for running various diffusion models, contains a vulnerability due to a heap buffer overflow in the parsing of SHORT_BINUNICODE opcode within PyTorch checkpoint files. This issue arises from a sign confusion when determining the length of the opcode, allowing a crafted .ckpt file to cause memcpy operations with excessively large lengths derived from negative values, leading to heap corruption. Applications that load untrusted .ckpt model files can face potential crashes and may be exploited for code execution based on the heap layout. To mitigate risks, users should avoid loading checkpoint files from untrusted sources and consider using safer formats whenever possible. The vulnerability has been addressed in version master-584-0a7ae07.
Affected Version(s)
stable-diffusion.cpp < master-584-0a7ae07
