Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid buffer underflow in CDEF pad_into_tmp16() #2536

Merged
merged 1 commit into from
Sep 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/asm/x86/cdef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub(crate) unsafe fn cdef_filter_block<T: Pixel>(
let mut tmp: Aligned<[u16; TMPSIZE]> =
Aligned::new([CDEF_VERY_LARGE; TMPSIZE]);
rust::pad_into_tmp16(
tmp.data.as_mut_ptr().offset(-2), // points to
tmp.data.as_mut_ptr().offset(TMPSTRIDE - 2), // points to
// *padding* upper left; the -2 is to make sure the
// block area is SIMD-aligned, not the padding
TMPSTRIDE,
Expand All @@ -101,7 +101,7 @@ pub(crate) unsafe fn cdef_filter_block<T: Pixel>(
(func)(
dst.data_ptr_mut() as *mut _,
T::to_asm_stride(dst.plane_cfg.stride),
tmp.data.as_ptr().offset(2 * TMPSTRIDE + 2 - 2) as *const u16,
tmp.data.as_ptr().offset(3 * TMPSTRIDE) as *const u16,
TMPSTRIDE,
pri_strength,
sec_strength,
Expand Down