libyuv/unit_test
Frank Barchard ef08f21f6d [libyuv] Fix security vulnerabilities in ScalePlane and ARGBAffineRow_C
This CL addresses two security findings related to integer overflows:

1. Input validation in ScalePlane, ScalePlane_16, and ScalePlane_12:
   Added checks to reject invalid dimensions (e.g. width <= 0, height
   == 0) and dimensions larger than 32768 (or smaller than -32768 for
   height). This prevents FixedDiv signed integer overflows that can
   lead to division by zero/overflow crashes (SIGFPE on x86) or
   incorrect step calculations.

2. Stride overflow in ARGBAffineRow_C:
   Casted pointer arithmetic operands to ptrdiff_t before multiplication
   (y * stride and x * 4) to ensure 64-bit calculations, preventing
   signed 32-bit integer overflow when calculating source pixel offsets.

Added unit tests to verify the input validation in ScalePlane functions.

Test: libyuv_unittest --gtest_filter=*InvalidInputs*
Test: libyuv_unittest --gtest_filter=*Scale*
Test: libyuv_unittest --gtest_filter=*TestAffine*
Bug: None

TAG=agy
CONV=0e990960-611b-4f38-94ec-24e79b66242e
R=wtc@google.com

Change-Id: I252af47a98e45dff8bb5f06308c3739c6eead741
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/7886217
Reviewed-by: Wan-Teh Chang <wtc@google.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
2026-05-29 18:30:38 -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 Mirrow AVX2 functions for Visual C 2026-05-15 15:05:31 -07:00
compare_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
convert_argb_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
convert_test.cc Mirrow AVX2 functions for Visual C 2026-05-15 15:05:31 -07:00
cpu_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -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 Mirrow AVX2 functions for Visual C 2026-05-15 15:05:31 -07:00
rotate_argb_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
rotate_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00
scale_argb_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -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 Unittests use ASSERT instead of EXPECT 2026-05-11 19:10: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 TestI400LargeSize fix for warning message build error 2025-08-01 12:03:11 -07:00
video_common_test.cc Unittests use ASSERT instead of EXPECT 2026-05-11 19:10:47 -07:00