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 <wtc@google.com>
Reviewed-by: Frank Barchard <fbarchard@google.com>
This commit is contained in:
Wan-Teh Chang 2026-06-01 16:10:21 -07:00 committed by libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 3c5fa6ef27
commit 06cc67fd2f

View File

@ -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