diff options
author | Frank Barchard <fbarchard@google.com> | 2022-06-21 16:07:01 -0700 |
---|---|---|
committer | libyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-06-22 00:11:49 +0000 |
commit | fe4a50df8e2a787e2919a8321dbe1412b94b20c6 (patch) | |
tree | 90eff546e86eb1c5023f38e783ed1cb7b4d41d68 /source/scale.cc | |
parent | e906ba9fe9df1cdc32307dbb1dcb1223d41bfd56 (diff) | |
download | libyuv-fe4a50df8e2a787e2919a8321dbe1412b94b20c6.tar.gz |
Bilinear scale up msan fix
- Avoid stepping to height + 1 for bilinear filter 2nd row for last row of source
- Box filter ubsan fix for 3/4 and 3/8 scaling for 16 bit planar
- Height 1 asan fixes
Bug: libyuv:935, b/206716399
Change-Id: I56088520f2a884a37b987ee5265def175047673e
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3717263
Reviewed-by: Wan-Teh Chang <wtc@google.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/scale.cc')
-rw-r--r-- | source/scale.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source/scale.cc b/source/scale.cc index ac009310..8147c291 100644 --- a/source/scale.cc +++ b/source/scale.cc @@ -1327,7 +1327,9 @@ void ScalePlaneBilinearUp(int src_width, src += src_stride; } ScaleFilterCols(rowptr + rowstride, src, dst_width, x, dx); - src += src_stride; + if (src_height > 2) { + src += src_stride; + } for (j = 0; j < dst_height; ++j) { yi = y >> 16; @@ -1342,7 +1344,9 @@ void ScalePlaneBilinearUp(int src_width, rowptr += rowstride; rowstride = -rowstride; lasty = yi; - src += src_stride; + if ((y + 65536) < max_y) { + src += src_stride; + } } } if (filtering == kFilterLinear) { @@ -1775,7 +1779,9 @@ void ScalePlaneBilinearUp_16(int src_width, src += src_stride; } ScaleFilterCols(rowptr + rowstride, src, dst_width, x, dx); - src += src_stride; + if (src_height > 2) { + src += src_stride; + } for (j = 0; j < dst_height; ++j) { yi = y >> 16; @@ -1790,7 +1796,9 @@ void ScalePlaneBilinearUp_16(int src_width, rowptr += rowstride; rowstride = -rowstride; lasty = yi; - src += src_stride; + if ((y + 65536) < max_y) { + src += src_stride; + } } } if (filtering == kFilterLinear) { |