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/convert.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/convert.cc')
-rw-r--r-- | source/convert.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/convert.cc b/source/convert.cc index b68fb1d3..0f48572d 100644 --- a/source/convert.cc +++ b/source/convert.cc @@ -776,6 +776,7 @@ int I422ToNV21(const uint8_t* src_y, // Allocate u and v buffers align_buffer_64(plane_u, halfwidth * halfheight * 2); + if (!plane_u) return 1; uint8_t* plane_v = plane_u + halfwidth * halfheight; I422ToI420(src_y, src_stride_y, src_u, src_stride_u, src_v, src_stride_v, @@ -892,6 +893,7 @@ int MT2TToP010(const uint8_t* src_y, void (*UnpackMT2T)(const uint8_t* src, uint16_t* dst, size_t size) = UnpackMT2T_C; align_buffer_64(row_buf, row_buf_size); + if (!row_buf) return 1; #if defined(HAS_UNPACKMT2T_NEON) if (TestCpuFlag(kCpuHasNEON)) { @@ -1091,6 +1093,7 @@ int I422ToNV21(const uint8_t* src_y, // Allocate 2 rows of vu. int awidth = halfwidth * 2; align_buffer_64(row_vu_0, awidth * 2); + if (!row_vu_0) return 1; uint8_t* row_vu_1 = row_vu_0 + awidth; for (y = 0; y < height - 1; y += 2) { @@ -2660,6 +2663,7 @@ int RGB24ToI420(const uint8_t* src_rgb24, // Allocate 2 rows of ARGB. const int row_size = (width * 4 + 31) & ~31; align_buffer_64(row, row_size * 2); + if (!row) return 1; #endif for (y = 0; y < height - 1; y += 2) { @@ -2836,6 +2840,7 @@ int RGB24ToJ420(const uint8_t* src_rgb24, // Allocate 2 rows of ARGB. const int row_size = (width * 4 + 31) & ~31; align_buffer_64(row, row_size * 2); + if (!row) return 1; #endif for (y = 0; y < height - 1; y += 2) { @@ -3015,6 +3020,7 @@ int RAWToI420(const uint8_t* src_raw, // Allocate 2 rows of ARGB. const int row_size = (width * 4 + 31) & ~31; align_buffer_64(row, row_size * 2); + if (!row) return 1; #endif for (y = 0; y < height - 1; y += 2) { @@ -3191,6 +3197,7 @@ int RAWToJ420(const uint8_t* src_raw, // Allocate 2 rows of ARGB. const int row_size = (width * 4 + 31) & ~31; align_buffer_64(row, row_size * 2); + if (!row) return 1; #endif for (y = 0; y < height - 1; y += 2) { @@ -3369,6 +3376,7 @@ int RGB565ToI420(const uint8_t* src_rgb565, // Allocate 2 rows of ARGB. const int row_size = (width * 4 + 31) & ~31; align_buffer_64(row, row_size * 2); + if (!row) return 1; #endif for (y = 0; y < height - 1; y += 2) { #if (defined(HAS_RGB565TOYROW_NEON) || defined(HAS_RGB565TOYROW_MSA) || \ @@ -3549,6 +3557,7 @@ int ARGB1555ToI420(const uint8_t* src_argb1555, // Allocate 2 rows of ARGB. const int row_size = (width * 4 + 31) & ~31; align_buffer_64(row, row_size * 2); + if (!row) return 1; #endif for (y = 0; y < height - 1; y += 2) { @@ -3762,6 +3771,7 @@ int ARGB4444ToI420(const uint8_t* src_argb4444, // Allocate 2 rows of ARGB. const int row_size = (width * 4 + 31) & ~31; align_buffer_64(row, row_size * 2); + if (!row) return 1; #endif for (y = 0; y < height - 1; y += 2) { |