Skip to content
Memory corruption Advisory Advanced CVE-2017-14450

Simple DirectMedia Layer SDL2_Image LWZ Decompression Buffer Overflow Vulnerability

A buffer overflow in SDL2_image's GIF parsing allows a crafted GIF to write past a global buffer, potentially causing a crash or other undefined behaviour. An attacker can trigger this by displaying a malicious image.

Lilith >_> Follow

Originally disclosed on Cisco Talos

High 7.1 View original

A buffer overflow vulnerability exists in the GIF image parsing functionality of SDL2image-2.0.2. A specially crafted GIF image can lead to a buffer overflow on a global section.

Lilith <(x_x)>, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the LZW decompression loop does not properly validate table entries, allowing a circular reference that causes an infinite loop and out-of-bounds write to the static stack buffer.

Impact

The out-of-bounds write occurs in the global data section and is limited to writing valid LZW code values, which could crash the application or potentially corrupt other global variables, but not directly lead to code execution.

What the attacker needed

Victim opens a crafted GIF; application uses SDL2_image

How it was found

  1. Craft a GIF image with a specially crafted LZW-compressed data stream that creates a circular table entry.
  2. Open or display the crafted GIF using an application that uses SDL2_image.
  3. The LZW decompression loop fails to terminate, causing an out-of-bounds write and a crash.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a program reads a GIF image, it decompresses the image data into a buffer. A bug in the decompression code lets a malicious GIF cause the program to write data past the end of that buffer, which can crash the program or corrupt memory. This happens because the code fails to stop a loop that keeps writing to the buffer.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Lilith >_>

View all

2 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.