aboutsummaryrefslogtreecommitdiff
path: root/source/planar_functions.cc
diff options
context:
space:
mode:
authorJoe Downing <joedow@google.com>2022-06-06 17:50:23 +0000
committerFrank Barchard <fbarchard@chromium.org>2022-06-07 01:20:14 +0000
commitc0c8c40b31636e575eaf07921d58d8f4ff3aa983 (patch)
treeba4ac530c7714d19e51bd8490da51c9ad2f9bb87 /source/planar_functions.cc
parentf8a1ee331419d5737e28a08ef97756e808965269 (diff)
downloadlibyuv-c0c8c40b31636e575eaf07921d58d8f4ff3aa983.tar.gz
Update CopyPlane to handle 0 width and height dimensions
If a width, height, and src/dst strides passed in are all 0, height is updated to 1 which means some CPU optimized functions may try to copy data when the dst rect is not valid. Bug: b:234340482 Change-Id: I63be1c6ba05d669d67f5079d812acbec09c8f6c9 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3689909 Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/planar_functions.cc')
-rw-r--r--source/planar_functions.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/planar_functions.cc b/source/planar_functions.cc
index c662cfef..141db6ef 100644
--- a/source/planar_functions.cc
+++ b/source/planar_functions.cc
@@ -35,6 +35,9 @@ void CopyPlane(const uint8_t* src_y,
int height) {
int y;
void (*CopyRow)(const uint8_t* src, uint8_t* dst, int width) = CopyRow_C;
+ if (width == 0 || height == 0) {
+ return;
+ }
// Negative height means invert the image.
if (height < 0) {
height = -height;