skia /
skcms /
d7c7dd8b955e9633da5ba763bb707854709d3033 more careful isfinite_() checks in skcms_TF_invert()
The fuzzer found a couple non-finite value edge cases:
In one, we end up with inv.a = inf, inv.d = finite, and tweak inv.b to
become -inf. Then when we assert ad+b >= 0, we calculate inf-inf >= 0,
which is nan >=0, false. To guard this, check tf_is_valid() after
b-tweak, which will catch any non-finite parameters.
In the other, gamma is large enough that we end up calculating
s = 0.983188629 + 0.951436281) ** 134.4673 == 3.45e38 == NaN
with powf_(). With s = NaN, so is as+b, and the check in powf_()
for x >= 0 fails. To fix, check isfinite_(s) before using s.
Bug: oss-fuzz:16674, oss-fuzz:16675
Change-Id: I8e83526d7358a0c806720cd1e1458758f3474efc
Reviewed-on: https://skia-review.googlesource.com/c/skcms/+/236860
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
6 files changed