From 7aab5a1f9f0be7f84010325d9b7f314540f2d36f Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 20 Jun 2014 09:59:56 -0700 Subject: [PATCH] Add negative guard Bug: 15631600 Change-Id: Idd7740f58876e73694fafb8ef55ebaff511f6dca --- libs/hwui/Interpolator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/hwui/Interpolator.cpp b/libs/hwui/Interpolator.cpp index 1f84b86bca732..fc0e8a059f225 100644 --- a/libs/hwui/Interpolator.cpp +++ b/libs/hwui/Interpolator.cpp @@ -112,6 +112,10 @@ float LUTInterpolator::interpolate(float input) { int i1 = (int) ipart; int i2 = MathUtils::min(i1 + 1, mSize - 1); + LOG_ALWAYS_FATAL_IF(i1 < 0 || i2 < 0, "negatives in interpolation!" + " i1=%d, i2=%d, input=%f, lutpos=%f, size=%zu, values=%p, ipart=%f, weight=%f", + i1, i2, input, lutpos, mSize, mValues, ipart, weight); + float v1 = mValues[i1]; float v2 = mValues[i2];