Skip to content
Memory corruption Advisory Advanced CVE-2022-21154

Leadtools fltSaveCMP integer overflow vulnerability

An integer overflow in the fltSaveCMP function of Leadtools 22 occurs when saving a specially crafted BMP file, leading to a buffer overflow. An attacker could exploit this to cause memory corruption, potentially leading to code execution.

Emmanuel Tacheau Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An integer overflow vulnerability exists in the fltSaveCMP functionality of Leadtools 22. A specially-crafted BMP file can lead to an integer overflow, that in turn causes a buffer overflow.

Emmanuel Tacheau, 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 a 32-bit integer overflow in the multiplication (uVar2 + 1) * BytesPerLine used to compute the allocation size, where BytesPerLine is derived from the width field of the BMP file.

Impact

An attacker could cause memory corruption, potentially leading to code execution, as indicated by the CVSS score of 8.8.

What the attacker needed

Victim opens a malicious BMP file; application uses Leadtools 22

The fix

The fix is included in updated versions of the affected components.

How it was found

  1. Craft a BMP file with a large width value.
  2. Load the BMP file using Leadtools.
  3. Save the loaded bitmap using L_SaveBitmap, which triggers fltSaveCMP.
  4. The integer overflow causes an undersized allocation, leading to a buffer overflow and 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 calculates how much memory to reserve, it multiplies two numbers. If the result is too large for the variable holding it, the number wraps around to a small value, so the program reserves too little memory. Later, when it copies data into that buffer, it writes past the end, corrupting memory and crashing.

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 Emmanuel Tacheau

View all

58 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.