Skip to content

samples_mv is unsafe #4155

Closed
Closed
@jonashaag

Description

@jonashaag

Description of the bug

We got crashes by using samples_mv when the original fitz handle was already deallocated.

IMO samples_mv should be changes so it should be renamed to something like unsafe_samples_mv.

How to reproduce the bug

Unfortunately I wasn't able to reproduce this outside of our production setting, but it went away by changing this code:

np.frombuffer(pixmap.samples_mv, ...)

to

np.frombuffer(pixmap.samples_mv, ...).copy()

PyMuPDF version

1.25.1

Operating system

Linux

Python version

3.12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions