libyuv/unit_test
Frank Barchard 7fcaff2f76 Avoid signed int overflow in scale functions using uint32_t
Use uint32_t for 16.16 fixed-point coordinates (uy, ux, max_y) in scale
loops across ScalePlane*, ScaleUV*, ScaleARGB*, ScalePlaneVertical*, and
C column scaling helpers. When downscaling large images (e.g.
src_height >= 26215 with dst_height == 2 or src_height == 32768),
signed 32-bit y + dy or (src_height << 16) exceeds INT_MAX. Using
uint32_t prevents undefined signed integer overflow up to src_height
32768 while staying in a single 32-bit register on 32-bit and 64-bit
targets (x86, ARM, WASM, and RISC-V RVV) with zero performance overhead.

Also check |src_width| and |src_height| <= 32768 in ARGBScale,
ARGBScaleClip, and UVScale_16, and avoid FixedDiv(32768, 1) overflow in
ScalePlane, ScalePlane_16, and ScaleSlope.

Bug: chromium:531172025
Test: libyuv_unittest --gtest_filter=*ScalePlaneOversizeHeight*:*ScalePlaneBoxMaxSrcHeight*:*ARGBScale*
Change-Id: Ica2e05d7dfe94f81c6631c587f1ff46c2ad44735
2026-10-08 00:26:24 -07:00
..
testdata Deprecate MIPS and MSA support. 2025-10-16 12:20:40 -07:00
basictypes_test.cc [libyuv] Keep LIBYUV_API in basic_types.h and remove legacy types and bool macros 2026-08-28 08:32:19 -07:00
color_test.cc [libyuv] Enable LIBYUV_ENABLE_ROWWIN and MSAN_MEMSET for MSan builds 2026-09-28 10:49:58 -07:00
compare_test.cc Compare AVX512BW and AVX2, intrinsics for Visual C and ROWWIN 2026-10-02 15:30:05 -07:00
convert_argb_test.cc clang format and bump version 2026-09-28 10:42:45 -07:00
convert_test.cc clang format and bump version 2026-09-28 10:42:45 -07:00
cpu_test.cc [libyuv] Add WASM SIMD128 and Relaxed SIMD for RAWToRGB24Row 2026-10-05 17:45:41 -07:00
cpu_thread_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
math_test.cc [libyuv] Keep LIBYUV_API in basic_types.h and remove legacy types and bool macros 2026-08-28 08:32:19 -07:00
planar_test.cc clang format and bump version 2026-09-28 10:42:45 -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 Avoid signed int overflow in scale functions using uint32_t 2026-10-08 00:26:24 -07:00
scale_plane_test.cc Avoid signed int overflow in scale functions using uint32_t 2026-10-08 00:26:24 -07:00
scale_rgb_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
scale_test.cc convert, scale: Add P010/P210/P410 convert paths and NV16/NV24/Px10 scale 2026-09-23 20:43:22 -07:00
scale_uv_test.cc Add a box filter to ScaleUV 2026-10-02 15:37:21 -07:00
unit_test.cc [libyuv] Add WASM SIMD128 and Relaxed SIMD for RAWToRGB24Row 2026-10-05 17:45:41 -07:00
unit_test.h [libyuv] Enable LIBYUV_ENABLE_ROWWIN and MSAN_MEMSET for MSan builds 2026-09-28 10:49:58 -07:00
video_common_test.cc convert, scale: Add P010/P210/P410 convert paths and NV16/NV24/Px10 scale 2026-09-23 20:43:22 -07:00