From 82589494dacdc3eb562a328daa28dd2655edb787 Mon Sep 17 00:00:00 2001 From: msarett Date: Tue, 29 Nov 2016 13:22:01 -0800 Subject: [PATCH] Fuzzer fix for overflow in some Lut8 profiles. Bug(?) in the tetrahedral interpolation causes output values to go out of range a bit (1.035/1.0) in the upper range. We will just clamp for now as a temporary fix. BUG=668784 Change-Id: I78dd90da7174133e647b1c6c6e914dbde5de123c Reviewed-on: https://skia-review.googlesource.com/5228 Reviewed-by: Matt Sarett Commit-Queue: Robert Aftias GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2535383002 NOTREECHECKS=true NOTRY=true NOPRESUBMIT=true Review-Url: https://codereview.chromium.org/2535383002 --- src/core/SkColorLookUpTable.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/SkColorLookUpTable.cpp b/src/core/SkColorLookUpTable.cpp index 73f3e88..76e0bca 100644 --- a/src/core/SkColorLookUpTable.cpp +++ b/src/core/SkColorLookUpTable.cpp @@ -92,6 +92,13 @@ void SkColorLookUpTable::interp3D(float dst[3], float src[3]) const { } } + // TODO(raftias): Figure out why this is going out of range (up to 1.0359!) + if (dst[i] > 1.f) { + dst[i] = 1.f; + } else if (dst[i] < 0.f) { + dst[i] = 0.f; + } + // Increment the table ptr in order to handle the next component. // Note that this is the how table is designed: all of nXXX // variables are multiples of 3 because there are 3 output -- 2.7.4