Heap-buffer-overflow in gs_type2_interpret in ghostscript

ghostscript Updated 02 Oct 2025

Summary

20/08/2022
MEDIUM
Yes i
Medium
Not published

OSV-2022-751: Heap-buffer-overflow in gs_type2_interpret. Affects ghostscript across 3 version ranges.

< 04b799c66a8993af13c4b9b5fafb3dcfa44a16c5 >= 441c9e3a4ca08fa7f7c00063af33196b0d88ebaf, < 36544f71d8742ba213e6ce003e52a81db3a89ba9 < a6ed2d417205ddf4194a2385402a5c97fe991013

Fixed in 36544f71d8742ba213e6ce003e52a81db3a89ba9. 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 Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Ghostscript is an open-source interpreter for the PostScript language and the PDF file format. It is widely used for rendering and converting documents. The vulnerability in question, identified as OSV-2022-751, is a heap-buffer-overflow issue that affects the gs_type2_interpret function in Ghostscript. This function is responsible for interpreting Type 2 fonts, and the vulnerability allows for a heap buffer overflow during the reading of glyph outlines. This vulnerability can potentially be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition.

Vulnerability Detail

The heap-buffer-overflow vulnerability in gs_type2_interpret arises due to a lack of proper input validation and boundary checks. When processing Type 2 fonts, the function fails to adequately verify the size of the buffer used for glyph outlines, leading to a buffer overflow. This can result in the corruption of adjacent memory regions, potentially allowing an attacker to execute arbitrary code or crash the application. The vulnerability was discovered through an OSS-Fuzz report and has been assigned a medium severity level.

How To Fix

Minimum fixed version

36544f71d8742ba213e6ce003e52a81db3a89ba9

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

If updating the Ghostscript package is not immediately feasible, a possible workaround is to disable the processing of Type 2 fonts. This can be achieved by modifying the Ghostscript configuration file to exclude Type 2 fonts from the list of supported font formats. Here is an example of how to modify the configuration file:

  1. Open the Ghostscript configuration file (usually located at /etc/ghostscript/ghostscript.conf).
  2. Locate the section that defines the supported font formats.
  3. Remove 'Type2' from the list of supported formats.
  4. Save the changes and restart the Ghostscript service.

Please note that this workaround may impact the rendering of certain documents that rely on Type 2 fonts.

Conclusion

In conclusion, the heap-buffer-overflow vulnerability in gs_type2_interpret in Ghostscript poses a potential security risk due to the lack of proper input validation. It is crucial to update the Ghostscript package to a fixed version or apply the provided workaround to mitigate the vulnerability. 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 the PDF file format. It is commonly used for rendering and converting documents.

The vulnerability allows for a heap buffer overflow, which can potentially be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition.

This vulnerability was identified through an OSS-Fuzz report, which is a continuous fuzzing service provided by Google.

The vulnerability has been assigned a medium severity level.

Yes, updating the Ghostscript package to a fixed version will mitigate the risk of exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for ghostscript.

How To Fix

Minimum fixed version

36544f71d8742ba213e6ce003e52a81db3a89ba9

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