Plus some minor cleanup and asserts.
Bug: oss-fuzz:23395
Change-Id: I667bee2d7f21864defe2fd97df9eb4e99d69d9ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296451
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>