Skip to content

fix: validate I420 planes before native conversion - #559

Merged
devopvoid merged 1 commit into
improve-video-views-and-message-loggingfrom
fix-i420-plane-validation
Nov 7, 2026
Merged

devopvoid merged 1 commit into
improve-video-views-and-message-loggingfrom
fix-i420-plane-validation

Conversation

@devopvoid

Copy link
Copy Markdown
Owner

VideoBufferConverter passed I420 planes to libyuv without validating their capacity, strides, or destination writability. A short buffer view could permit native access outside its declared memory, and read-only destination planes could be modified.

Share and extend the existing VideoFrame plane validation across all four converter paths. Every plane is checked for positive dimensions, sufficient stride, direct storage, and sufficient capacity using 64-bit arithmetic. Destination planes must also be writable. Validation completes before conversion writes any pixels; exact last-row capacities and read-only source planes remain supported.

Add regression coverage for each Y/U/V plane, all packed-buffer paths, invalid strides and capacities, null and heap planes, read-only destinations, and valid padded layouts. Update the Java contracts and converter guide.

All 380 affected tests pass against the rebuilt JNI library, including under -Xcheck:jni. The supplied PlaneProbe also confirms that both invalid cases are rejected and the read-only destination stays unchanged.

Based on #558; this PR contains only the I420 validation commit.

@devopvoid
devopvoid added this pull request to stack #560 November 7, 2026 09:19
@devopvoid
devopvoid force-pushed the fix-i420-plane-validation branch from 0ea8d21 to 0df9f50 Compare November 7, 2026 13:47
@devopvoid
devopvoid merged commit 3d2c2c0 into main Nov 7, 2026
8 of 15 checks passed
@devopvoid
devopvoid deleted the fix-i420-plane-validation branch November 7, 2026 13:47
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