Skip to content

fix(ffmpeg): align swscale output buffers - #5301

Merged
lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
br0nzu:public-ffmpeg-swscale-output-buffers
Jul 7, 2026
Merged

lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
br0nzu:public-ffmpeg-swscale-output-buffers

Conversation

@br0nzu

@br0nzu br0nzu commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

This aligns FFmpeg/libswscale destination image buffers and validates the buffer-size, frame-fill, and swscale return paths before decoded pixels are consumed.

The change prevents narrow high-bit-depth VP9/GBR inputs from writing past OIIO's destination buffer during swscale conversion, and adds a regression case for the width-1 high-bit-depth FFmpeg path.

@lgritz lgritz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good!

Needs clang-format fix, just in one isolated spot

Allocate FFmpeg swscale destination buffers with a safe image alignment and validate the size, fill, and scale operations before using decoded pixels. This prevents narrow planar 16-bit conversions from writing past OIIO's destination buffer.

Signed-off-by: Dongju Lee <dongpago2@gmail.com>
@br0nzu
br0nzu force-pushed the public-ffmpeg-swscale-output-buffers branch from c00dce7 to 91038b2 Compare July 7, 2026 00:09
@br0nzu

br0nzu commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, fixed.

@lgritz lgritz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lgritz
lgritz merged commit d9fc577 into AcademySoftwareFoundation:main Jul 7, 2026
28 checks passed
lgritz pushed a commit to lgritz/OpenImageIO that referenced this pull request Jul 15, 2026
…5301)

This aligns FFmpeg/libswscale destination image buffers and validates
the buffer-size, frame-fill, and swscale return paths before decoded
pixels are consumed.

The change prevents narrow high-bit-depth VP9/GBR inputs from writing
past OIIO's destination buffer during swscale conversion, and adds a
regression case for the width-1 high-bit-depth FFmpeg path.

Signed-off-by: Dongju Lee <dongpago2@gmail.com>
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.

2 participants