Commit 775a4bed authored by Sean Purser-Haskell's avatar Sean Purser-Haskell Committed by Sean Purser-haskell
Browse files

Correct row padding to avoid overflow in all cases.

Change-Id: I88041e954fa6cff5986458309bb28fa2e3c9758c
parent 9aeaeb7d
...@@ -101,9 +101,8 @@ void AV1WarpFilterTest::RunCheckOutput(warp_affine_func test_impl) { ...@@ -101,9 +101,8 @@ void AV1WarpFilterTest::RunCheckOutput(warp_affine_func test_impl) {
uint8_t *input = input_ + border; uint8_t *input = input_ + border;
// The warp functions always write rows with widths that are multiples of 8. // The warp functions always write rows with widths that are multiples of 8.
// So to avoid a buffer overflow, we may need to add a "tail" to the buffer // So to avoid a buffer overflow, we may need to pad rows to a multiple of 8.
// for the last row (round up to the nearest 8 elements) int output_n = ((out_w + 7) & ~7) * out_h;
int output_n = ((out_w * out_h) + 7) & ~7;
uint8_t *output = new uint8_t[output_n]; uint8_t *output = new uint8_t[output_n];
uint8_t *output2 = new uint8_t[output_n]; uint8_t *output2 = new uint8_t[output_n];
int32_t mat[8]; int32_t mat[8];
...@@ -225,9 +224,8 @@ void AV1HighbdWarpFilterTest::RunCheckOutput( ...@@ -225,9 +224,8 @@ void AV1HighbdWarpFilterTest::RunCheckOutput(
int i, j, sub_x, sub_y; int i, j, sub_x, sub_y;
// The warp functions always write rows with widths that are multiples of 8. // The warp functions always write rows with widths that are multiples of 8.
// So to avoid a buffer overflow, we may need to add a "tail" to the buffer // So to avoid a buffer overflow, we may need to pad rows to a multiple of 8.
// for the last row (round up to the nearest 8 elements) int output_n = ((out_w + 7) & ~7) * out_h;
int output_n = ((out_w * out_h) + 7) & ~7;
uint16_t *input_ = new uint16_t[h * stride]; uint16_t *input_ = new uint16_t[h * stride];
uint16_t *input = input_ + border; uint16_t *input = input_ + border;
uint16_t *output = new uint16_t[output_n]; uint16_t *output = new uint16_t[output_n];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment