aboutsummaryrefslogtreecommitdiff
path: root/source/planar_functions.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2023-12-04 01:16:59 -0800
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-12-04 22:55:20 +0000
commitdef473f501acbd652cd4593fd2a90a067e8c9f1a (patch)
treec4aec58c96864262fd184f4fa448e0374ec681a8 /source/planar_functions.cc
parente6d5adb3629a4aedb385f948fc5a8eb379a5ca3b (diff)
downloadlibyuv-def473f501acbd652cd4593fd2a90a067e8c9f1a.tar.gz
malloc return 1 for failures and assert for internal functions
Bug: libyuv:968 Change-Id: Iea2f907061532d2e00347996124bc80d079a7bdc Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5010874 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.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/planar_functions.cc b/source/planar_functions.cc
index 93a714e6..1c94e260 100644
--- a/source/planar_functions.cc
+++ b/source/planar_functions.cc
@@ -3027,7 +3027,8 @@ int I420Blend(const uint8_t* src_y0,
// Row buffer for intermediate alpha pixels.
align_buffer_64(halfalpha, halfwidth);
- if (!halfalpha) return 1;
+ 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)) {
@@ -4711,7 +4712,8 @@ 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;
+ if (!rowbuf)
+ return 1;
memset(rowbuf, 0, 16);
memset(rowbuf + (4 + width) * 4, 0, 16);
float* row = (float*)(rowbuf + 16);
@@ -4862,7 +4864,6 @@ 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;
@@ -4871,6 +4872,8 @@ static int ARGBSobelize(const uint8_t* src_argb,
uint8_t* row_y0 = row_y + kEdge;
uint8_t* row_y1 = row_y0 + row_size;
uint8_t* row_y2 = row_y1 + row_size;
+ if (!rows)
+ return 1;
ARGBToYJRow(src_argb, row_y0, width);
row_y0[-1] = row_y0[0];
memset(row_y0 + width, row_y0[width - 1], 16); // Extrude 16 for valgrind.
@@ -5657,7 +5660,8 @@ 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;
+ if (!rows)
+ return 1;
for (y = 0; y < height - 1; y += 2) {
// Split Y from UV.