Repository navigation
fix: validate I420 planes before native conversion - #559
Merged
devopvoid merged 1 commit intoNov 7, 2026
Merged
Conversation
devopvoid
force-pushed
the
fix-i420-plane-validation
branch
from
November 7, 2026 13:47
0ea8d21 to
0df9f50
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.