Allow division by zero in fill_triangle_3's perspective divide

The following code handles this case cleanly: The bounds don't fit in
fixed-point, so we fall back to treating the triangle as a path. The
path code drops the primitive for being non-finite.

Bug: oss-fuzz:48319
Change-Id: Icca7a2c8b3b8d3a67931cc6736a2fb216fb831d9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556608
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2022-07-08 11:07:03 -04:00 committed by SkCQ
parent 475c3e049c
commit 5ab7fe15e0

View File

@ -283,7 +283,7 @@ static void fill_triangle_3(const VertState& state, SkBlitter* blitter, const Sk
const int count = SkTo<int>(outP - outPoints);
SkASSERT(count == 0 || count == 3 || count == 4);
for (int i = 0; i < count; ++i) {
float scale = 1.0f / outPoints[i].fZ;
float scale = sk_ieee_float_divide(1.0f, outPoints[i].fZ);
dst[i].set(outPoints[i].fX * scale, outPoints[i].fY * scale);
}
return count;