Skip to content

Python crash with invalid dataWindow #2023

Open
@markdjwilliams

Description

@markdjwilliams

Running the following script causes OpenEXR 3.3.3 to crash (the output "Done" never appears):

import OpenEXR
import numpy as np

w, h = 640, 480
rgb = np.zeros((w, h, 3), dtype=np.float32)

header = {
    "type": OpenEXR.scanlineimage,
    "compression": OpenEXR.ZIP_COMPRESSION,
    "displayWindow": ((0, 0), (w - 1, h - 1)),
    "dataWindow": ((0, 0), (50, 100)),
}

part = OpenEXR.Part(header, {"RGB": rgb})

f = OpenEXR.File([part])

print("Writing...")
f.write("output.exr")
print("Done")

This is because the dataWindow provided in the header is inconsistent with the shape of the rgb ndarray. Correcting this aspect of the header allows the file to be written successfully.

Ideally the Python binding would raise an exception in this scenario.

Metadata

Metadata

Assignees

Labels

good first issuePossible one-day project for somebody new

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions