Skip to content

fix(python): validate inputs in write_png helper - #9805

Open
Bartok (Bartok9) wants to merge 1 commit into
microsoft:mainfrom
Bartok9:aerial/python-write-png-validate-20260723
Open

Bartok (Bartok9) wants to merge 1 commit into
microsoft:mainfrom
Bartok9:aerial/python-write-png-validate-20260723

Conversation

@Bartok9

Copy link
Copy Markdown

Summary

write_png now validates filename/image shape before calling OpenCV and raises OSError if imwrite fails, so silent empty writes are not ignored.

Motivation

Callers treated a failed PNG write as success when OpenCV returned false and only logged. Empty paths and bad array ranks also failed obscurely inside OpenCV.

Verification

  • Offline unit tests in PythonClient/airsim/tests/test_write_png.py (empty name, None image, bad ndim; write path when cv2 present).
  • Diff limited to utils.write_png + tests.

AI-assisted; human-reviewed.

Claim: bartok
Operator: bartok
Campaign: aerial-drone

Reject empty filenames and non-2D/3D arrays before OpenCV, and raise
OSError when imwrite fails so callers do not miss silent write errors.

Signed-off-by: Bartok9 <danielrpike9@gmail.com>
@Bartok9
Bartok (Bartok9) force-pushed the aerial/python-write-png-validate-20260723 branch from a24a2b7 to 17d40b1 Compare October 25, 2026 21:27

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant