diff options
author | Frank Barchard <fbarchard@google.com> | 2023-10-27 10:12:13 -0700 |
---|---|---|
committer | libyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-10-27 17:41:36 +0000 |
commit | 31e1d6f896615342d5d5b6bde8f7b50b3fd698dc (patch) | |
tree | 685ffd3182496e78e4e23c45fdd3729501cca38c /source/planar_functions.cc | |
parent | 331c361581896292fb46c8c6905e41262b7ca95f (diff) | |
download | libyuv-31e1d6f896615342d5d5b6bde8f7b50b3fd698dc.tar.gz |
Check allocations that return NULL and return early
BUG=libyuv:968
Change-Id: I9e8594440a6035958511f9c50072820131331fc8
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4977552
Reviewed-by: Wan-Teh Chang <wtc@google.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/planar_functions.cc')
-rw-r--r-- | source/planar_functions.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/planar_functions.cc b/source/planar_functions.cc index f6ec0dac..93a714e6 100644 --- a/source/planar_functions.cc +++ b/source/planar_functions.cc @@ -3027,6 +3027,7 @@ int I420Blend(const uint8_t* src_y0, // Row buffer for intermediate alpha pixels. align_buffer_64(halfalpha, halfwidth); + if (!halfalpha) return 1; for (y = 0; y < height; y += 2) { // last row of odd height image use 1 row of alpha instead of 2. if (y == (height - 1)) { @@ -4710,6 +4711,7 @@ int GaussPlane_F32(const float* src, { // 2 pixels on each side, but aligned out to 16 bytes. align_buffer_64(rowbuf, (4 + width + 4) * 4); + if (!rowbuf) return 1; memset(rowbuf, 0, 16); memset(rowbuf + (4 + width) * 4, 0, 16); float* row = (float*)(rowbuf + 16); @@ -4860,6 +4862,7 @@ static int ARGBSobelize(const uint8_t* src_argb, // 3 rows with edges before/after. const int row_size = (width + kEdge + 31) & ~31; align_buffer_64(rows, row_size * 2 + (kEdge + row_size * 3 + kEdge)); + if (!rows) return 1; uint8_t* row_sobelx = rows; uint8_t* row_sobely = rows + row_size; uint8_t* row_y = rows + row_size * 2; @@ -5654,6 +5657,7 @@ int UYVYToNV12(const uint8_t* src_uyvy, int awidth = halfwidth * 2; // row of y and 2 rows of uv align_buffer_64(rows, awidth * 3); + if (!rows) return 1; for (y = 0; y < height - 1; y += 2) { // Split Y from UV. |