[zlib] Avoid crashing in check_match when prev_match == -1

prev_match can be set to -1 after sliding the window. In that case, the
window has slid past the first byte of the last match, which means it
cannot be compared in check_match.

This would cause zlib to crash on some inputs to deflate when built
with ZLIB_DEBUG enabled.

Check for this situation and avoid crashing by not trying to compare
the first byte.

Bug: 1113142
Change-Id: I26f006d81b91591e07fb02207e64b8440f7a5c50
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2426443
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810195}
GitOrigin-RevId: c1560c99950947946ff9b5d5978f70bc975ab3af
3 files changed