From 06cc67fd2f87cccfabe04668ae6556fb8cea04e0 Mon Sep 17 00:00:00 2001 From: Wan-Teh Chang Date: Mon, 1 Jun 2026 16:10:21 -0700 Subject: [PATCH] Don't ignore UVCopy() and UVCopy_16() return value Change-Id: I9d7944da60bf73ec6a578a43540c5a247ad00417 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/7891418 Commit-Queue: Wan-Teh Chang Reviewed-by: Frank Barchard --- source/scale_uv.cc | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/source/scale_uv.cc b/source/scale_uv.cc index 95ac5307f..b16b591f8 100644 --- a/source/scale_uv.cc +++ b/source/scale_uv.cc @@ -1005,9 +1005,8 @@ static int ScaleUV(const uint8_t* src, #ifdef HAS_UVCOPY if (dx == 0x10000 && dy == 0x10000) { // Straight copy. - UVCopy(src + (y >> 16) * (ptrdiff_t)src_stride + (x >> 16) * 2, - src_stride, dst, dst_stride, clip_width, clip_height); - return 0; + return UVCopy(src + (y >> 16) * (ptrdiff_t)src_stride + (x >> 16) * 2, + src_stride, dst, dst_stride, clip_width, clip_height); } #endif } @@ -1106,19 +1105,17 @@ int UVScale_16(const uint16_t* src_uv, #ifdef HAS_UVCOPY if (!filtering && src_width == dst_width && (src_height % dst_height == 0)) { if (dst_height == 1) { - UVCopy_16(src_uv + ((src_height - 1) / 2) * (ptrdiff_t)src_stride_uv, - src_stride_uv, dst_uv, dst_stride_uv, dst_width, dst_height); - } else { - dy = src_height / dst_height; - if (src_stride_uv > INT_MAX / dy) { - return -1; - } - UVCopy_16(src_uv + ((dy - 1) / 2) * (ptrdiff_t)src_stride_uv, - dy * src_stride_uv, dst_uv, dst_stride_uv, dst_width, - dst_height); + return UVCopy_16( + src_uv + ((src_height - 1) / 2) * (ptrdiff_t)src_stride_uv, + src_stride_uv, dst_uv, dst_stride_uv, dst_width, dst_height); } - - return 0; + dy = src_height / dst_height; + if (src_stride_uv > INT_MAX / dy) { + return -1; + } + return UVCopy_16(src_uv + ((dy - 1) / 2) * (ptrdiff_t)src_stride_uv, + dy * src_stride_uv, dst_uv, dst_stride_uv, dst_width, + dst_height); } #endif