Skip to content

Integer Overflow or Wraparound #4995

@qossayrida

Description

@qossayrida

Description

Affected versions may be vulnerable to CVE-2026-3308, an integer overflow / wraparound issue in pdf_load_image_imp().

A specially crafted PDF with malformed image data can trigger a heap out-of-bounds write during image decoding. This may lead to memory corruption, application crash, or potentially arbitrary code execution.

Reproduction

The issue can be triggered by processing a crafted PDF through normal PyMuPDF PDF/image handling, for example:

import fitz

doc = fitz.open("crafted_file.pdf")

for page in doc:
    for image in page.get_images(full=True):
        xref = image[0]
        pix = fitz.Pixmap(doc, xref)

For security reasons, I am not attaching a public PoC file.

Expected Behavior

PyMuPDF should safely reject the malformed PDF or raise a controlled exception without crashing or writing out of bounds.

Environment

  • OS: Windows
  • Python: 3.12
  • PyMuPDF: All versions

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions