libyuv/unit_test
Frank Barchard 9f05e62032 Fix HalfWidthRow_16To8 test buffer allocations and stride
HalfWidthRow_16To8 downsamples 2x2 16-bit pixels to 8-bit.
For width output pixels, row 0 and row 1 each require width * 2 uint16_t
elements (4 * width bytes).
With two rows separated by src_uv_stride, total source buffer requirement
is 8 * width bytes (4 * width uint16_t elements).

The previous buffer allocation only allocated kPixels * 4 bytes
(2 * kPixels uint16_t elements).
Because align_buffer_page_end places the buffer at the end of a page,
reading the second row caused an out-of-bounds access past the page
boundary, failing the test:

[ RUN      ] LibYUVPlanarTest.HalfWidthRow_16To8_Opt
[  FAILED  ] LibYUVPlanarTest.HalfWidthRow_16To8_Opt
[----------] Global test environment tear-down
[==========] 3603 tests from 8 test suites ran.
[  PASSED  ] 3602 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] LibYUVPlanarTest.HalfWidthRow_16To8_Opt

 1 FAILED TEST.

Use align_buffer_page_end_16 to allocate 4 * width uint16_t elements
(8 * width bytes) and set src_uv_stride to 2 * width elements
in HalfWidthRow_16To8_Opt and HalfWidthRow_16To8_Any.

Bug: None
Test: LibYUVPlanarTest.HalfWidthRow_16To8_*
Change-Id: Ieba81ec211a34cc315e60fc26aad64fb41a88641
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8252627
Commit-Queue: Frank Barchard <fbarchard@google.com>
Reviewed-by: Wan-Teh Chang <wtc@google.com>
2026-08-14 12:16:02 -07:00
..
testdata Deprecate MIPS and MSA support. 2025-10-16 12:20:40 -07:00
basictypes_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
color_test.cc BGRAToI420 use BgraConstants for a direct conversion using AVX512BW 2026-06-08 12:21:47 -07:00
compare_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
convert_argb_test.cc Correct vin/vout buffer sizes in ANY21CT 2026-08-10 13:47:24 -07:00
convert_test.cc Correct vin/vout buffer sizes in ANY21S and ANY13 2026-08-10 14:20:54 -07:00
cpu_test.cc add bmm detect and vdpphps in util/cpuid 2026-06-09 14:52:48 -07:00
cpu_thread_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
math_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
planar_test.cc Fix HalfWidthRow_16To8 test buffer allocations and stride 2026-08-14 12:16:02 -07:00
rotate_argb_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
rotate_test.cc BGRAToI420 use BgraConstants for a direct conversion using AVX512BW 2026-06-08 12:21:47 -07:00
scale_argb_test.cc ARGBScale: Fix signed integer overflow when scaling large heights 2026-08-12 15:49:52 -07:00
scale_plane_test.cc [libyuv] Fix security vulnerabilities in ScalePlane and ARGBAffineRow_C 2026-05-29 18:30:38 -07:00
scale_rgb_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
scale_test.cc BGRAToI420 use BgraConstants for a direct conversion using AVX512BW 2026-06-08 12:21:47 -07:00
scale_uv_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
unit_test.cc Deprecate MIPS and MSA support. 2025-10-16 12:20:40 -07:00
unit_test.h BGRAToI420 use BgraConstants for a direct conversion using AVX512BW 2026-06-08 12:21:47 -07:00
video_common_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00