Stack-buffer-underflow in gs_type2_interpret in ghostscript

ghostscript Updated 02 Oct 2025

Summary

09/09/2022
N/A
Yes i
Unrated
Not published

OSV-2022-866: Stack-buffer-underflow in gs_type2_interpret. Affects ghostscript versions >= 441c9e3a4ca08fa7f7c00063af33196b0d88ebaf, < 92b792f6a34d2436772dd141760faf925e139c01. Fixed in 92b792f6a34d2436772dd141760faf925e139c01. 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

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-866, affects the gs_type2_interpret function in Ghostscript. This function is responsible for interpreting Type 2 fonts, which are commonly used in PostScript and PDF files. The vulnerability can lead to a stack-buffer-underflow, potentially resulting in a crash or arbitrary code execution.

Vulnerability Detail

The stack-buffer-underflow vulnerability in gs_type2_interpret arises from a flaw in the code logic. When processing a Type 2 font, the function fails to properly validate the size of a buffer before copying data into it. As a result, an attacker can craft a malicious font file that triggers a stack-buffer-underflow, leading to memory corruption and potential code execution. This vulnerability can be exploited remotely by enticing a user to open a specially crafted document or font file. Successful exploitation could allow an attacker to execute arbitrary code with the privileges of the Ghostscript process.

How To Fix

Minimum fixed version

92b792f6a34d2436772dd141760faf925e139c01

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 workaround, users can consider disabling the processing of Type 2 fonts in Ghostscript. This can be achieved by modifying the configuration or command-line options to exclude Type 2 fonts from being interpreted. However, this workaround may impact the rendering of certain documents or cause compatibility issues, so it should be carefully evaluated before implementation.

Conclusion

In conclusion, the stack-buffer-underflow vulnerability in gs_type2_interpret in Ghostscript can lead to memory corruption and potential code execution. It is crucial to update Ghostscript to a version that includes the fix and consider implementing the recommended workaround if necessary. For further support on vulnerability remediation, 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 can lead to a stack-buffer-underflow, potentially resulting in a crash or arbitrary code execution. An attacker could exploit this vulnerability to execute arbitrary code with the privileges of the Ghostscript process.

The vulnerability can be exploited remotely by enticing a user to open a specially crafted document or font file that triggers the stack-buffer-underflow.

Yes, the vulnerability has been fixed in Ghostscript. Users should update their installations to a version that includes the fix.

A workaround is to disable the processing of Type 2 fonts in Ghostscript. However, this may impact document rendering and compatibility.

Related vulnerabilities

Recent vulnerabilities recorded for ghostscript.

How To Fix

Minimum fixed version

92b792f6a34d2436772dd141760faf925e139c01

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