Heap-buffer-overflow in sampled_data_finish in ghostscript

ghostscript Updated 02 Oct 2025

Summary

27/05/2021
HIGH
Yes i
High
Not published

OSV-2021-803: Heap-buffer-overflow in sampled_data_finish. Affects ghostscript across 2 version ranges.

< 9d6e533f6486fe3fd0a6e29b23d1811361adf904 >= 45e765e59a45b46dcb05e8c729689a7c0574a48c, < 2a3129365d3bc0d4a41f107ef175920d1505d1f7

Fixed in 2a3129365d3bc0d4a41f107ef175920d1505d1f7. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Ghostscript is an open-source interpreter for the PostScript language and for PDF. It is widely used for rendering and converting documents. The vulnerability in question, identified as OSV-2021-803, is a heap-buffer-overflow issue that affects the sampled_data_finish function in Ghostscript. This function is responsible for finalizing sampled data processing. The vulnerability can potentially lead to a crash or enable an attacker to execute arbitrary code.

Vulnerability Detail

The heap-buffer-overflow vulnerability in sampled_data_finish arises from a WRITE operation that exceeds the bounds of the allocated buffer by 16 bytes. This issue was reported through the OSS-Fuzz project, and the crash state indicates that the vulnerability can be triggered during the execution of sampled_data_finish, sampled_data_continue, and interp functions. The severity of this vulnerability is classified as HIGH. The vulnerability was introduced in the codebase between the commits f209fb3a0f50cd0a9974d8627a4ac7f358f60c8a and 470897e484fb0bfaa8553e0ccd5b9db91eda008b. The fix for this vulnerability was implemented in the commits 25b8457be76ba09c2380e5058ca4878e1a7f5ee8 to 9d6e533f6486fe3fd0a6e29b23d1811361adf904.

How To Fix

Minimum fixed version

2a3129365d3bc0d4a41f107ef175920d1505d1f7

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

As a temporary workaround, users can consider implementing input validation and sanitization measures to mitigate the risk of exploitation. Additionally, restricting access to the affected functionality or implementing appropriate access controls can help reduce the attack surface.

Conclusion

In conclusion, the heap-buffer-overflow vulnerability in sampled_data_finish in Ghostscript can have serious security implications. It is crucial to update to a fixed version of the package to mitigate the risk. For further assistance or support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for ghostscript →

Share this vulnerability

FAQ

Ghostscript is an open-source interpreter for the PostScript language and for PDF. It is commonly used for rendering and converting documents.

The heap-buffer-overflow vulnerability in sampled_data_finish can lead to a crash or enable an attacker to execute arbitrary code.

This vulnerability was reported through the OSS-Fuzz project, which focuses on fuzzing open-source software to uncover potential security issues.

The severity of this vulnerability is classified as HIGH.

To fix this vulnerability, it is recommended to update the Ghostscript package to a version that includes the fix. Details on the specific commits can be found in the provided vulnerability details.

Related vulnerabilities

Recent vulnerabilities recorded for ghostscript.

How To Fix

Minimum fixed version

2a3129365d3bc0d4a41f107ef175920d1505d1f7

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