From ac9b96c076f1d62f34fbc9182d1aca46d2f0b75a Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Fri, 3 Jan 2014 00:51:12 +0000 Subject: [PATCH] Work around for 1 pixel destination BUG=302 TEST=*1x1* R=tpsiaki@google.com Review URL: https://webrtc-codereview.appspot.com/6519004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@943 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- source/scale_common.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/scale_common.cc b/source/scale_common.cc index 6cc5ff8cb..5c760b964 100644 --- a/source/scale_common.cc +++ b/source/scale_common.cc @@ -634,6 +634,13 @@ void ScaleSlope(int src_width, int src_height, assert(src_height != 0); assert(dst_width > 0); assert(dst_height > 0); + // Check for 1 pixel and avoid FixedDiv overflow. + if (dst_width == 1) { + dst_width = src_width; + } + if (dst_height == 1) { + dst_height = src_height; + } if (filtering == kFilterBox) { // Scale step for point sampling duplicates all pixels equally. *dx = FixedDiv(Abs(src_width), dst_width);