# GHSA-v8gq-5grq-9728: mozjpeg DecompressScanlines::read_scanlines is Unsound

- Severity: High (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2020-07-04T12:00:00.000Z
- Modified: 2023-11-08T04:23:09.541Z
- Also known as: RUSTSEC-2020-0165

## Description

This issue and vector is similar to [RUSTSEC-2020-0029] of `rgb` crate which `mozjpeg` depends on.

Affected versions of `mozjpeg` crate allow creating instances of any type `T` from bytes,
and do not correctly constrain `T` to the types for which it is safe to do so.

Examples of safety violation possible for a type `T`:

* `T` contains a reference type, and it constructs a pointer to an invalid, arbitrary memory address.
* `T` requires a safety and/or validity invariant for its construction that may be violated.

The issue was fixed in 0.8.19 by using safer types and involving `rgb` dependency bump.

[RUSTSEC-2020-0029]: https://rustsec.org/advisories/RUSTSEC-2020-0029.html

(As written by GitHub Advisory Database.)

## Affected

- mozjpeg (crates.io): before 0.8.19; from 0.0.0-0 before 0.8.19

## References

- <https://github.com/ImageOptim/mozjpeg-rust/issues/10> (report, web)
- <https://github.com/ImageOptim/mozjpeg-rust> (package)
- <https://rustsec.org/advisories/RUSTSEC-2020-0165.html> (advisory, web)
- <https://crates.io/crates/mozjpeg> (package)
- <https://github.com/kornelski/rust-rgb/issues/35> (report)
- <https://rustsec.org/advisories/RUSTSEC-2020-0029.html> (advisory)

## Sources

- GitHub Advisory Database: [GHSA-v8gq-5grq-9728](https://github.com/advisories/GHSA-v8gq-5grq-9728), CC-BY-4.0, modified 2023-11-08
- RustSec Advisory Database: [RUSTSEC-2020-0165](https://rustsec.org/advisories/RUSTSEC-2020-0165.html), CC0-1.0, modified 2023-11-08

---

Page: https://cve.day/GHSA-v8gq-5grq-9728 · Whole record: https://cve.day/GHSA-v8gq-5grq-9728.json · Rebuilt by cve.day 2026-11-25T22:56:43.010Z
