Commit 3c862e3d authored by Frank Barchard's avatar Frank Barchard

Fix stride bug for msan on I420Interpolate.

When using C version of I420Interpolate for msan, a 50% interpolation
would cause stride to be cast to int, which could cause erroneous
memory reads on 64 bit build.
This CL makes the stride use ptrdiff_t for HalfRow_C

BUG=libyuv:582
TESTED=try bots tests
R=dhrosa@google.com

Review URL: https://codereview.chromium.org/1872953002 .
parent 870d9b51
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 1582 Version: 1583
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1582 #define LIBYUV_VERSION 1583
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -1917,8 +1917,7 @@ int InterpolatePlane(const uint8* src0, int src_stride0, ...@@ -1917,8 +1917,7 @@ int InterpolatePlane(const uint8* src0, int src_stride0,
#endif #endif
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
InterpolateRow(dst, src0, src1 - src0, InterpolateRow(dst, src0, src1 - src0, width, interpolation);
width, interpolation);
src0 += src_stride0; src0 += src_stride0;
src1 += src_stride1; src1 += src_stride1;
dst += dst_stride; dst += dst_stride;
......
...@@ -2147,7 +2147,7 @@ void ARGBAffineRow_C(const uint8* src_argb, int src_argb_stride, ...@@ -2147,7 +2147,7 @@ void ARGBAffineRow_C(const uint8* src_argb, int src_argb_stride,
} }
// Blend 2 rows into 1. // Blend 2 rows into 1.
static void HalfRow_C(const uint8* src_uv, int src_uv_stride, static void HalfRow_C(const uint8* src_uv, ptrdiff_t src_uv_stride,
uint8* dst_uv, int width) { uint8* dst_uv, int width) {
int x; int x;
for (x = 0; x < width; ++x) { for (x = 0; x < width; ++x) {
...@@ -2155,7 +2155,7 @@ static void HalfRow_C(const uint8* src_uv, int src_uv_stride, ...@@ -2155,7 +2155,7 @@ static void HalfRow_C(const uint8* src_uv, int src_uv_stride,
} }
} }
static void HalfRow_16_C(const uint16* src_uv, int src_uv_stride, static void HalfRow_16_C(const uint16* src_uv, ptrdiff_t src_uv_stride,
uint16* dst_uv, int width) { uint16* dst_uv, int width) {
int x; int x;
for (x = 0; x < width; ++x) { for (x = 0; x < width; ++x) {
...@@ -2176,7 +2176,7 @@ void InterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr, ...@@ -2176,7 +2176,7 @@ void InterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr,
return; return;
} }
if (y1_fraction == 128) { if (y1_fraction == 128) {
HalfRow_C(src_ptr, (int)(src_stride), dst_ptr, width); HalfRow_C(src_ptr, src_stride, dst_ptr, width);
return; return;
} }
for (x = 0; x < width - 1; x += 2) { for (x = 0; x < width - 1; x += 2) {
...@@ -2206,7 +2206,7 @@ void InterpolateRow_16_C(uint16* dst_ptr, const uint16* src_ptr, ...@@ -2206,7 +2206,7 @@ void InterpolateRow_16_C(uint16* dst_ptr, const uint16* src_ptr,
return; return;
} }
if (source_y_fraction == 128) { if (source_y_fraction == 128) {
HalfRow_16_C(src_ptr, (int)(src_stride), dst_ptr, width); HalfRow_16_C(src_ptr, src_stride, dst_ptr, width);
return; return;
} }
for (x = 0; x < width - 1; x += 2) { for (x = 0; x < width - 1; x += 2) {
......
Markdown is supported
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