Unsound DecompressScanlines::read_scanlines in mozjpeg

mozjpeg Updated 02 Oct 2025

Summary

16/09/2022
HIGH
Yes i
High
Not published

GHSA-v8gq-5grq-9728: mozjpeg DecompressScanlines::read_scanlines is Unsound. Affects mozjpeg versions < 0.8.19. Fixed in 0.8.19. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

mozjpeg is an open-source crate available on crates.io that provides a Rust interface for working with the MozJPEG library. MozJPEG is a JPEG encoder that aims to improve the compression efficiency of JPEG images. It is widely used in various applications and libraries for image processing and compression. However, versions of the mozjpeg crate prior to 0.8.19 are affected by a vulnerability that allows the creation of instances of any type from bytes without proper constraints. This can lead to safety violations and potential memory corruption.

Vulnerability Detail

The vulnerability in mozjpeg arises from the ability to create instances of any type from bytes without proper constraints. This means that it is possible to construct pointers to invalid or arbitrary memory addresses, or violate safety and validity invariants required for the construction of certain types. This can result in memory corruption, crashes, or even potential code execution vulnerabilities. The issue is similar to the vulnerability identified in the rgb crate, which mozjpeg depends on. The vulnerability was addressed in version 0.8.19 of mozjpeg by using safer types and updating the rgb dependency.

How To Fix

Minimum fixed version

0.8.19

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is recommended to update the mozjpeg crate to the fixed version as mentioned in the 'how_to_fix' section.

Conclusion

The vulnerability in mozjpeg can lead to memory corruption and potential code execution vulnerabilities. It is crucial to update the mozjpeg crate to version 0.8.19 or later to mitigate the risk. Additionally, it is advisable to review the project code for any potential unsafe usage and ensure proper input validation and error handling mechanisms are in place. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for mozjpeg →

Share this vulnerability

FAQ

mozjpeg is a Rust interface for the MozJPEG library, which is a JPEG encoder that aims to improve compression efficiency.

Versions of mozjpeg prior to 0.8.19 are affected by this vulnerability.

The vulnerability can lead to memory corruption, crashes, or even potential code execution vulnerabilities.

To fix the vulnerability, update the mozjpeg crate to version 0.8.19 or later and review the project code for any potential unsafe usage.

There is no known workaround for this vulnerability. Updating the mozjpeg crate is the recommended solution.

Related vulnerabilities

Recent vulnerabilities recorded for mozjpeg.

How To Fix

Minimum fixed version

0.8.19

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback