Fix assert in SkBlurEngine/SkBitmap

This was a curious one to reproduce because it only reproduced
under the following GN args:
    extra_cflags = [ "-DSK_AVOID_SLOW_RASTER_PIPELINE_BLURS=1" ]
    is_debug = true

I could not get an ASAN release to fire, despite the overflow in
SkBitmap::getAddr causing an assert and a bad pointer to be
calculated, because the bad pointer is not used.

The test case gets into eval_blur_passes with:
srcBounds = {fLeft = 0, fTop = 0, fRight = 1, fBottom = 64}
dstBounds = {fLeft = 1, fTop = 99, fRight = 4, fBottom = 165}
and a makerX->window() of exactly 1 so we skip the x only blur.
loopStart and loopEnd both become 1, but in the old code, we
computed the srcAddr and dstAddr w/o checking that the loop start
is actually in the range of the src bounds, which it isn't.
This caused an assert because the address calculated is off
the right side, but the Y loop wouldn't run because loopStart
is not less than loopEnd.

Now by checking the loopStart and loopEnd, we'll prevent
even calculating the offset. Because loopEnd <= srcBounds.right()
we'll avoid walking off the end.

Change-Id: Id1cddf0cbc4360cba9f18bcae9f088c73610fcaf
Bug: 508075339
Fixed: 508075339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1225736
Auto-Submit: Kaylee Lubick <kjlubick@google.com>
Commit-Queue: Kaylee Lubick <kjlubick@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2 files changed